i can't build app when use ProGuard in Android Studio - android

I am using lasted version of Android Studio, and i have obfuscated my project by ProGuard in Android Studio.
edit content of Build.gradlesuch as this :
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
but when start the build project, an error like that
warning Image :
How can I fix this?

Simply add -dontwarn com.github.siyamed.shapeimageview to your proguard-rules.pro.

I had same issue,try to change minifyEnabled true to minifyEnabled false.
And just refer this enter link description here

Related

Android version release warning message: This App Bundle contains Java/Kotlin code, which might be obfuscated

I got this warning message:
This App Bundle contains Java/Kotlin code, which might be obfuscated. We recommend you upload a deobfuscation file to make your crashes and ANRs easier to analyze and debug
what does it mean? what is the shortest solution for this?
Seems like it's a warning message coming from the new play console, you can solve it just by setting your minimum api level to 29 or even better by uploading the retrace mapping file as described here.
Enable minify :
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
After building apk/app bundle you can find /app/build/outputs/mapping/release/mapping.txt file . New console will allow you to upload mapping.txt along with your apk or bundle. You can find this option from App bundles and APKs menus.(According to this)
Just changing minifyEnabled to true worked for me
You can solve this by just enabling minify in your build. gradle(app) file:
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
Just enable minify in your build.gradle(app) file:
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
proguard-android-optimize.txt sometimes is unsupported so using the following is safer (see this):
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}

Release apk won't run

I'm building release APK with flutter run --release but I'm getting this exception
Failed to register native method io.flutter.view.FlutterNativeView.nativeRunBundleAndSource(JLjava/lang/String;Ljava/lang/String;Ljava/lang/String;)V in /data/app/com.example.myapp-1/base.apk
However, debug variant runs normally so if I run the app just with flutter run everything is fine.
By the way, I'm executing flutter clean before avery build.
What is the cause of this?
Found the solution on my own, but I'm posting this answer for people who are having the same problem.
Turns out that build.gradle was causing exception
shrinkResources true // for this to work minifyEnabled must be set to true
minifyEnabled true // if set to true apk will not build
Solved it by using only proGuard so snippet below is working buildTypes section of app-level build.gradle
buildTypes {
release {
debuggable false
useProguard true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
}

Android proguarded apk still readable

I tried to proguard my app. It successfully obfuscated the apk. However, when i try to view the java code of my apk using Apk_oneclick, I am able to. I have created a release version of my apk. Still the problem persist. Any help would be much appreciated.
Thanks in advance.
build.gradle:
Proguard Rules:
Java code from the release-apk:
For enabling ProGuard configurations for your application you need to enable it in your module level gradle file. you need to set the value of minifyEnabled true.
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
You can also enable shrinkResources true which will remove resources that ProGuard flaggs as unused.
buildTypes {
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
You need to set following property
and add some rules in proguard-android
buildTypes {
release {
debuggable false
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
Got it working. Cleaned the project and ran the same with some changes in the Proguard rules.

Proguard not obfuscating in Android Studio

I am trying to export signed apk, obfuscated with proguard. But after process, I can see my code and my class names in decompiler tool. Spent 1 day , but can't understand what I missed.
In my gradle file I specified :
buildTypes {
release {
apply plugin: 'maven'
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
proguard-rules.pro is empty.
Should I specify anything else to enable proguarding ? After decompilation
Change minifyEnabled to true to enable proguard in your build configuration.

How do I disable proguard for building my Android app?

It used to be that proguard was controlled by project.properties, but that's no longer the case, and the Android documentation has not been updated. The project.properties file now clearly states that the it is generated by Android Tools and changes will be erased. I've tried commenting out the proguard.config line, but when I compile, it rewrites the project.properties, and continues to use proguard. What is the current method of disabling proguard? Thanks!
# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must be checked in Version Control Systems.
#
# To customize properties used by the Ant build system edit
# "ant.properties", and override values to adapt the script to your
# project structure.
#
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt:proguard-google-api-client.txt
# Project target.
target=android-17
android.library.reference.1=../../../../android-sdk-linux/extras/google/google_play_services/libproject/google-play-services_lib
set this
minifyEnabled false
in your app build.gradle
Like this:
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
set
useProguard false
in your app build.gradle
like
buildTypes {
release {
minifyEnabled false
useProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
Have you tried to add the next line to your proguard configuration file (to the beginning of the file) :
-dontobfuscate
?
Try to delete the proguard directory in your project. So proguard will forget its mapping.
According to the React-Native Docs, To disable Proguard, set def enableProguardInReleaseBuilds to false in your android/app/build.gradle:
/**
* Run Proguard to shrink the Java bytecode in release builds.
*/
def enableProguardInReleaseBuilds = false // Instead of true
In my case
1 ->
add this line in the android tag:
android {
def enableProguardInReleaseBuilds = false // Instead of true
2 -> then add this line
buildTypes {
release {
minifyEnabled false
shrinkResources = false
signingConfig signingConfigs.release
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
I hope it will work for you

Categories

Resources