I'm getting this error:
Error:Execution failed for task ':ProjectName:compileUniversalDebugJava'.
> Could not find property 'bootClasspath' on com.android.build.gradle.AppExtension_Decorated#26fd94a1.
Why is that?
I'm building Android app with gradle on Android Studio.
Apparently I had to update com.android.tools.build:gradle:0.10.+ instead of com.android.tools.build:gradle:0.9.+. Here in my build.gradle:
dependencies {
classpath 'com.android.tools.build:gradle:0.10.+'
...
}
Related
My project is a simple app to print longitude and latitude
I´m using:
Linux Mint 19.3
classpath 'com.android.tools.build:gradle:4.1.3'
compileSdkVersion 31
and the results of the compilation is show below:
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:processDebugResources'.
Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
Failed to transform play-services-base-17.0.0.aar (com.google.android.gms:play-services-base:17.0.0) to match attributes {artifactType=android-compiled-dependencies-resources, org.gradle.status=release}.
> Execution failed for AarResourcesCompilerTransform: /home/luis/.gradle/caches/transforms-2/files-2.1/bb3cc3ced1388fcd9c0c925717b75148/jetified-play-services-base-17.0.0.
> AAPT2 aapt2-4.1.3-6503028-linux Daemon #6: Unexpected error during compile '/home/luis/.gradle/caches/transforms-2/files-2.1/bb3cc3ced1388fcd9c0c925717b75148/jetified-play-services-base-17.0.0/res/drawable-xxhdpi-v4/common_google_signin_btn_icon_dark_normal_background.9.png', attempting to stop daemon.
How about minSDKVersion ?
try with:
compileSdkVersion 31
minSdkVersion 21
targetSdkVersion 29
and geolocator: ^7.6.0
It's related to your local cache.
There are two ways to solve this.
Try fluter pub cache repair.
Open Your Project ProjectName/android project in android studio and syn Gradle. And build it through the android studio.
At the end, I figured out to fix this problem at the android/build.gradle
downgraded 4.1.0 to 3.4.2. Why? because I have another app using this version.
dependencies {
//classpath 'com.android.tools.build:gradle:4.1.0'
classpath 'com.android.tools.build:gradle:3.4.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
When I upgrade android studio version to 2.3,and gradle version to 3.3,and android gradle plugin version to 2.3.0,and buildToolsVersion version to 25.0.0,It has some problem when I use this command "gradlew assembleRelease" to package my application.
Shrinking...
Printing usage to [E:\workspace\android_source\src\app\build\outputs\mapping\XXX\release\usage.txt]...
Removing unused program classes and class elements...
Original number of program classes: 10650
Final number of program classes: 10247
Optimizing...
Warning: Exception while processing task java.io.IOException: java.lang.NullPointerException
:app:transformClassesAndResourcesWithProguardForXXXRelease FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:transformClassesAndResourcesWithProguardForXXXRelease'.
> Job failed, see logs for details
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 1 mins 34.554 secs
but when I downgrade android gradle plugin to version 2.2.3,and buildToolsVersion to 23.0.1,It works well.
I have resolved this problem,It is because the proguard version is too low,if we update the gradle plugin,the version is greater than 2.3.0,we must use the proguard version 5.3.2 or higher,this is how to use the high proguard version,here is two solutions:
1.Add these code in build script method of your build.gradle file:
buildscript {
...
configurations.all {
resolutionStrategy {
force 'net.sf.proguard:proguard-gradle:5.3.3'
}
}
}
then,repackage.
2.To download proguard.jar by this link
.then,create a folder in root path of your project,put the jar in this folder,add these code in your build.gradle file:
buildscript {
repositories {
flatDir{dirs 'proguard'}
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
classpath ':proguard:'
}
}
then,repackage.
I want to run my custom task after assembleDebug task in Android Studio.My normal build.gradle is
apply plugin: 'com.android.application'
android {
...
}
dependencies {
...
}
task printName{
println 'Hello Guffy'
}
printName.shouldRunAfter(tasks.assembleDebug)
// or printName.shouldRunAfter(assembleDebug)
// or assembleDebug.shouldRunAfter(printName)
which is not compiling.The gradle error is
Error:(36, 0) Could not get unknown property 'assembleDebug' for task set
Is assembleDebug or other tasks not available to custom tasks ? Or is there any basic error I am doing ? Thanks
Suggested by Piotr Zawadzki, putting task in quotes worked .
So the code should be like
printName.shouldRunAfter("assembleDebug")
My project was working fine, I stopped development for a week and when I came back, when I build the project I get this exception:
Error:Execution failed for task ':app:transformClassesWithPreJackRuntimeLibrariesForDebug'. > com.android.sched.scheduler.RunnerProcessException: Error during 'ReachingDefinitions' runner on 'static void org.mozilla.universalchardet.prober.contextanalysis.JapaneseContextAnalysis.
I tried to change org.gradle.jvmargs=-Xmx1024m, it was actually 1536.
No change.
What is this exception about? How to fix it?
Thank you.
UPDATE:
I was planning to use Data Binding in this project. Apparently,
apply plugin: 'com.android.databinding'
and this
classpath 'com.android.databinding:dataBinder:1.0-rc4'
caused his behaviour.
The question is why?
You just need to enable DataBinding in build.gradle to use it
android{
defaultConfig{
dataBinding {
enabled true
}
}
}
(Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
java.lang.RuntimeException: Exception while checking library jar)
Please can anybody help me.
This error is generally showed, when you have duplicate dependencies with different versions.
Check your dependencies thoroughly.
you can also use following command:
gradle dependencies
and if your dependencies are in order try adding following in build.gradle file
defaultConfig {
multiDexEnabled true
}