-
Notifications
You must be signed in to change notification settings - Fork 51
Open
Description
With a help of a script I've managed to add a namespace for image_compression_flutter instead of modifying it manually: fluttercandies/flutter_image_compress@6266ba4
// Source: https://medium.com/@vortj/solving-namespace-errors-in-flutters-android-gradle-configuration-c2baa6262f8b
subprojects {
afterEvaluate { project ->
if (project.hasProperty('android')) {
project.android {
if (namespace == null) {
namespace = project.group.toString() // Set namespace as fallback
}
project.tasks.whenTaskAdded { task ->
if (task.name.contains('processDebugManifest') || task.name.contains('processReleaseManifest')) {
task.doFirst {
File manifestFile = file("${projectDir}/src/main/AndroidManifest.xml")
if (manifestFile.exists()) {
String manifestContent = manifestFile.text
if (manifestContent.contains('package=')) {
manifestContent = manifestContent.replaceAll(/package="[^"]*"/, "")
manifestFile.write(manifestContent)
println "Removed 'package' attribute from ${manifestFile}"
}
}
}
}
}
}
}
}
}
Unfortunately now I am getting:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':image_compression_flutter:compileDebugKotlin'.
> Inconsistent JVM-target compatibility detected for tasks 'compileDebugJavaWithJavac' (1.8) and 'compileDebugKotlin' (21).
Consider using JVM Toolchain: https://kotl.in/gradle/jvm/toolchain
Learn more about JVM-target validation: https://kotl.in/gradle/jvm/target-validation
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.
BUILD FAILED in 51s
Error: Gradle task assembleDebug failed with exit code 1
Not entirely sure why this issue is being thrown, as my project uses consistent JVM versions:
compileOptions {
coreLibraryDesugaringEnabled true
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
and these settings doesn't seem to be present in:
.pub-cache/hosted/pub.dev/image_compression_flutter-1.0.4/android/build.gradle
Metadata
Metadata
Assignees
Labels
No labels