--Android Studio 2.2.3 (Windows 10 64 bit)
--Build Tools version 25
--Android Gradle Plugin Version 2.2.3
After upgrade to latest support libraries (25.1.0 from 23.4.0) and change of compile version (25 from 23) I get this error:
Error:com.android.sched.util.config.PropertyIdException: Property 'jack.library.import' (in Options): element #7: The version of the library file '..\app\build\intermediates\transforms\preJackPackagedLibraries\debug\jars\8000\1f\classes-1b6639e8217419d056942b0dacd1542739f1709f.jar' is not supported anymore. Library version: 3.2 - Current version: 3.3 - Minimum compatible version: 3.3
...
BUILD FAILED
Has anyone ever had this problem? In the mentioned .jar file I can find some AnimatedVectorDrawble related files. My app build.gradle
android {
compileSdkVersion 25
buildToolsVersion '25.0.2'
defaultConfig {
applicationId "package"
minSdkVersion 14
targetSdkVersion 25
versionCode 111
versionName "1.1.1"
}
defaultConfig {
vectorDrawables.useSupportLibrary = true
jackOptions.enabled = true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
dexOptions {
maxProcessCount 4
javaMaxHeapSize "2g"
}
buildTypes {
release {
minifyEnabled false
useProguard false
shrinkResources false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
minifyEnabled false
useProguard false
shrinkResources false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
applicationIdSuffix ".dev"
versionNameSuffix "-DEV"
ext.enableCrashlytics = false
}
}
}
Based on the error message, it appears that Jack-enabled builds do not handle all cases where you update Gradle build settings. Jack keeps a cache of pre-compiled stuff (preJackPackagedLibraries), and something that you changed caused Jack to not like that pre-compiled material. Ideally, the build system would detect this case and simply re-compile it, but apparently it does not.
Cleaning the project (Build > Clean Project) hopefully clears up this problem in all cases.
Related
I received the deobfuscation file error from Google Play Console on my app and found out I would have to add the line in my app level build.gradle file
android.defaultConfig.ndk.debugSymbolLevel = 'FULL
Before adding this line , I checked out further prerequisites and learnt that I would require AGP 4.1+, I already had 4.1.2 but to be safe I updated to 7.0.2. I also installed the latest NDK and CMake versions.
After completing the prerequisites, I added the required line. Upon generating an AAB , I analyzed the AAB but there was no native debug symbol file or folder. I checked the app\build\outputs directory and there is no native_debug_symbols file generated there.
This is how my gradle file looks now -
android {
compileSdkVersion 31
defaultConfig {
applicationId "com.quicklyservices.restaurants"
minSdkVersion 19
targetSdkVersion 31
versionCode 292
versionName "2.28.2"
ndkVersion '23.1.7779620'
multiDexEnabled true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
ndk{
debugSymbolLevel = "full"
}
}
externalNativeBuild {
cmake {
version '3.18.1'
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
buildToolsVersion '28.0.3'
compileOptions {
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
}
buildFeatures {
viewBinding true
}
kotlinOptions {
jvmTarget = '1.8'
}
}
I have tried everything mentioned in the official documentations but I cannot seem to generate the required files. It would be very helpful if I could get a solution to this.
I am following macrobenchmark setup configurations from -
https://developer.android.com/studio/profile/macrobenchmark#configuration
In following code in my macrobenchmark's build.gradle
android {
compileSdkVersion 30
buildToolsVersion "30.0.3"
defaultConfig {
minSdkVersion 29
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"
}
targetProjectPath = ":app" // Note that your module name may be different
experimentalProperties["android.experimental.self-instrumenting"] = true
buildTypes {
release {
debuggable = true
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
following build error is thrown while gradle sync:
A problem occurred evaluating project ':macrobenchmark'.
> Could not get unknown property 'experimentalProperties' for extension 'android' of type com.android.build.gradle.TestExtension.
I'm new to android, any help is appreciated, thanks in advance.
Fixed the error, via following -
Updated Android Studio to Arctic Fox Beta Version
Updated gradle version in project build.gradle to 7.0 beta4
Found solution through documentation of benchmark samples repository provided by google and comparing gradle files.
Due other dependencies I had to update to version 7.1.0-alpha02 of gradle plugin in project build.gradle file.
And this property got recognized.
I need to compile a project but i need solve any errors. My Android Grandle Plugin version is 3.1.1 and Grandle Version is 4.4
Build file '/home/javier/Descargas/VisitaOficialArriboOfflinev2/VisitaOficialArriboOffline/app/build.gradle' line: 79A problem occurred evaluating project ':app'.> Could not find method ndkversion() forarguments [21.3.6528147] on object of type com.android.build.gradle.AppExtension.
this is my build:gardle:app the line that have the error is ndkversion '21.3.6528147'
//apply plugin: 'com.android.feature' for instant app
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-android'
android {
compileSdkVersion 27
buildToolsVersion '27.0.3'
defaultConfig {
minSdkVersion 23
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
ndk{
abiFilters "x86", "armeabi-v7a", "armeabi-v8a", "x86_64"
}
externalNativeBuild {
cmake {
cppFlags ""
}
}
}
buildTypes {
release {
//Remove minifyEnabled true from release if you are getting error while creating final releasing api.
minifyEnabled false
debuggable false
useProguard true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
//Remove minifyEnabled true from debug if you are getting error while compiling the app. As this time its running debug part.
minifyEnabled false
debuggable true
useProguard true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
externalNativeBuild {
cmake {
path file ('CMakeLists.txt')
}
}
// Configure only for each module that uses Java 8
// language features (either in its source code or
// through dependencies).
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
splits {
//....
}
//The line with error
ndkversion '21.3.6528147' }
The path route of my ndk is "ndk.dir=/home/javier/Android/Sdk/ndk"
Thanks for your help
Edit the local.properties file, and add the following line to it, under sdk.dir -
ndk.dir=/path/to/your/Android/Sdk/ndk/21.3.6528147
and then delete or comment out the ndkVersion '21.3.6528147' line from the gradle file.
That should solve the issue.
If you now get the CMake was unable to find a build program corresponding to "Ninja" error, uninstall cmake 3.10 and install cmake 3.6 instead.
Now everything should work fine, but just in case it still insists on the wrong cmake for some reason, you can also the following line to your local.properties file:
cmake.dir=/path/to/your/Android/sdk/cmake/3.6.4111459
In my current project, I'm using OpenCV as the main library to play with image processing, when I build a bundle debug to check the size of ABB, I find it very huge (50MB).
Following this article of How to Generate and Extract APK Files from Android App Bundle (AAB), I get this :
My Question
How can I reduce the APK size if I'm using OpenCV library, I know there's a way to do that, for example, removing the unused .SO file, some apps on Google Play use the OpenCV library and their size does not reach 10MB.
Gradle file:
android {
compileSdkVersion 29
dexOptions {
preDexLibraries = false
javaMaxHeapSize "4g"
}
defaultConfig {
applicationId "maa.abc"
minSdkVersion 21
targetSdkVersion 29
versionCode 1
versionName "1.0"
multiDexEnabled true
ndk.abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
OpenCV library version : 4.1.2
Library used to get OpenCV : com.github.iamareebjamal:opencv-android:4.1.2
Debug apk run fine but release signed apk crash on main activity. I have checked everything but I don't know where is the problem.[build.gradle][1]
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.newtrendsdeveloper.unorthodox"
minSdkVersion 19
targetSdkVersion 28
versionCode 51
versionName "4.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {
minifyEnabled true
shrinkResources true
proguardFiles 'proguard-rules.pro'
}
debug {}
}
flavorDimensions "color"
productFlavors {
blue {}
green {
applicationIdSuffix ".test"
versionNameSuffix "\"4.0-Microsoft Windows [Version 10.0.17134.407]\n" +
" (c) 2018 Microsoft Corporation. All rights reserved.\n" +
" \n" +
" C:\\Users\\HP\\Downloads\\Tusky-master\\Tusky-master\\app>\";" + getGitSha()
}
}
lintOptions {
disable 'MissingTranslation'
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
androidExtensions {
experimental = true
}
testOptions {
unitTests {
includeAndroidResources = true
}
}
}
ext.supportLibraryVersion = '28.0.0'
ext.daggerVersion = '2.19'
// If libraries are changed here, they should also be changed in the LicenseActivity
dependencies {
implementation('com.mikepenz:materialdrawer:6.0.`enter code here`9#aar') {
transitive = true
}
Most probably it's the minifyEnabled true in your gradle file.
This removes unused code and obfuscates the code. So you can check what is the crash log, probably it's a class not found or null pointer exception. Check what is missing, and then in the build output you can search for a file called usage.txt. This includes all the things that were removed, and you can make sure it is being removed. If it is, then modify the proguard rules to keep that class.
You can check the documentation to understand more about proguard:
https://developer.android.com/studio/build/shrink-code
Of course another way to check if this is the issue is just to change the minifyEnabled to false and try again. If that works, then you can turn it back on and figure out what is causing the problem.