Cannot generate native-debug-symbols file in Android studio - android

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.

Related

Could not get unknown property 'experimentalProperties' for extension 'android' | Android Jetpack Macrobenchmark

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.

How to reduce the APK size if I'm using OpenCV library

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

Android JACK compiler error after upgrade to latest support library

--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.

android - textView textColor not taking effect on device

I have a layout like this. Here I set the textColor to red.
When I run this on emulator, everything works as expected. However, when I run on device, textColor is white. It used to work on device.
I did lot of code refactoring with emulator. I might have changed something that could lead to this issue. I was hoping if someone else has encountered a similar issue.
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="EXAMPLE"
android:textColor="#color/red"
android:textSize="60sp" />
What could be the issue?
android {
dexOptions {
javaMaxHeapSize "6g"
}
compileSdkVersion 23
buildToolsVersion "23.0.2"
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
}
defaultConfig {
applicationId "someID"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
productFlavors {
dev {
minSdkVersion 15
}
prod {
minSdkVersion 15
}
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
I resolved this issue by cleaning all build directories and clean/rebuild.
I also removed productflavors/devDebug from .gradle. That must have caused the issue as I was it was configured for minSDKVersion 15 and I was trying to run on 22.
From Android docs:
android {
productFlavors {
// Define separate dev and prod product flavors.
dev {
// dev utilizes minSDKVersion = 21 to allow the Android gradle plugin
// to pre-dex each module and produce an APK that can be tested on
// Android Lollipop without time consuming dex merging processes.
minSdkVersion 21
}
prod {
// The actual minSdkVersion for the application.
minSdkVersion 14
}
}
...
buildTypes {
release {
runProguard true
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
}
}

buildTypes not working build.gradle Android Studio

I am new to Android studio and I need to add:
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
debuggable true
}
}
in my build.gradle Android Studio, but getting error:
Gradle DSL method not found:'buildTypes()'
Try to configure buildTypes from "File-> Project Structure" and select your module, you can easily configure everything on the right side panel.
are you sure that your build file is set up correctly?
The buildTypes have to be in the android closure. It should look something like this
note: this is just a example you can't just copy and paste this
android {
compileSdkVersion "Google Inc.:Glass Development Kit Preview:19"
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.your.package"
minSdkVersion 19
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
Hope this is of use for you

Categories

Resources