Proguard -obfuscationdictionary in used aar library caused file not found exception - android

I add aar library to my project, that has following in proguard rules:
-obfuscationdictionary build/obfuscation-dictionary.txt
-classobfuscationdictionary build/class-dictionary.txt
I got error, when build with
isMinifyEnabled = true
java.nio.file.NoSuchFileException: C:\Users....gradle\caches\transforms-3\07478cf30c50e6fe3820e9cff7b7aab9\transformed...\build\obfuscation-dictionary.txt
java.nio.file.NoSuchFileException: C:\Users....gradle\caches\transforms-3\07478cf30c50e6fe3820e9cff7b7aab9\transformed...\build\class-dictionary.txt
I tried add next to my project, but it didn't help
release {
minifyEnabled true
debuggable false
// automatically add your proguard rules into your library user
consumerProguardFiles 'proguard-rules.pro'
proguardFiles 'proguard-rules-dic.pro', 'proguard-rules.pro'
}

Related

DexGuard error while trying to enable minifying in ProGuard

I am trying to enable minifying in an Android app using ProGuard.
When I set minifyEnabled to false it builds but as soon as I set it to true:
buildTypes {
debug {
minifyEnabled false
jniDebuggable true
versionNameSuffix '_DEBUG'
zipAlignEnabled true
}
release {
minifyEnabled true
proguardFile getDefaultDexGuardFile('dexguard-release.pro')
proguardFile 'dexguard-project.txt'
jniDebuggable false
signingConfig signingConfigs.release
}
I get a gradle syncing error:
ERROR: minifyEnabled is set to 'true' for variant <name of the variant>.
And stacktrace states:
org.gradle.api.ProjectConfigurationException: A problem occurred configuring project ':MainApp'
Caused by: org.gradle.api.GradleException: Errors occurred during DexGuard plugin configuration.
What does DexGuard have to do here?
Dexguard's documentation says:
DexGuard expects its inputs to be unobfuscated, so make sure none of the variants you specify here have the minifyEnabled options set to true.
You can't use both Dexugard and Proguard in the same library. You have to either disable Dexguard or Proguard.
Dexguard is an improved (and paid) version of Progurad. I don't see any reason for using Proguard when you have Dexguard.

Can't find proguad mapping file

I have enable proguard, but for tracking bugs I need a mapping file to upload to Google Play.
Here is my gradle configuration of proguard:
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
try to find the mapping file at build/outputs/proguard/release/mapping.txt in your application module's directory.
if you have -dontobfuscate in your proguard. please remove it
rebuild and rerun.. Then it should able to see the mapping file in proguard directory

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

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

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