Open calcitem opened 11 months ago
Hi, I face the same issue with compileSdkVersion 34 and gradle version 8.1.1, and it let my build failed. It is neccessary to use SDK 34, and it's neccessary with gradle 8.0 above. With gradle 8.0 above, the namespace in modules that app use is necessary. So I have add below code in android/build.gradle:
subprojects{
afterEvaluate { project ->
if (project.hasProperty('android')) {
project.android {
if (namespace == null) {
namespace project.group
}
}
}
}
}
And it solve in other library, expect for fluttertoast.
The error:
Incorrect package="io.github.ponnamkarthik.toast.fluttertoast" found in source AndroidManifest.xml: C:\Users\WishMobile\AppData\Local\Pub\Cache\hosted\pub.dev\fluttertoast-8.2.2\android\src\main\AndroidManifest.xml.
Setting the namespace via the package attribute in the source AndroidManifest.xml is no longer supported.
Recommendation: remove package="io.github.ponnamkarthik.toast.fluttertoast" from the source AndroidManifest.xml: C:\Users\WishMobile\AppData\Local\Pub\Cache\hosted\pub.dev\fluttertoast-8.2.2\android\src\main\AndroidManifest.xml.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':fluttertoast:processDebugManifest'.
> A failure occurred while executing com.android.build.gradle.tasks.ProcessLibraryManifest$ProcessLibWorkAction
> Incorrect package="io.github.ponnamkarthik.toast.fluttertoast" found in source AndroidManifest.xml: C:\Users\WishMobile\AppData\Local\Pub\Cache\hosted\pub.dev\fluttertoast-8.2.2\android\src\main\AndroidManifest.xml.
Setting the namespace via the package attribute in the source AndroidManifest.xml is no longer supported.
Recommendation: remove package="io.github.ponnamkarthik.toast.fluttertoast" from the source AndroidManifest.xml: C:\Users\WishMobile\AppData\Local\Pub\Cache\hosted\pub.dev\fluttertoast-8.2.2\android\src\main\AndroidManifest.xml.
I've try the below code, but it still shows the same error message.
if (namespace == null) {
if (project.group == "io.github.ponnamkarthik.toast.fluttertoast") {
namespace "kotlin.io.github.ponnamkarthik.toast.fluttertoast"
} else {
namespace project.group
}
}
How can I fix it? Many thanks ! :)
OK, I found a temporary solution to pass the issue. I print the project.group and find it shows "com.example.FlutterToast". So I just change the code as below and it works.
if (namespace == null) {
if (project.group == "com.example.FlutterToast") {
namespace "io.github.ponnamkarthik.toast.fluttertoast"
} else {
namespace project.group
}
}
I am experiencing a compilation error with the Github Action, the error message is as follows:
The complete log of the compilation can be found at: https://github.com/calcitem/Sanmill/actions/runs/6397029084/job/17364177927
Interestingly, the pull request here https://github.com/ponnamkarthik/FlutterToast/pull/443/commits/c7e27bbf1d131f43dc3095ce42160cd05397c515 was already merged.
These three lines were added:
However, it appears that your
namespace
block needs to be moved inside thedefaultConfig
block. Please refer to the code structure below:In the above code, the
namespace
block has been moved inside thedefaultConfig
block. This should correctly set the namespace for your project.The aforementioned solution is conjectural and remains unverified. The provisional approach I'm presently utilizing is detailed here:
https://github.com/calcitem/FlutterToast/commit/5a1d491871a79eebf057c7bae410af9620a0b9ed
Though this alternative allows for successful compilation, it might not align with your initial objective of maintaining compatibility with older versions of the Android Gradle Plugin (AGP).