简体   繁体   中英

android -proguard preventing app to be installed

when I build and make my app apk file , it doesn't install on the phone , it just said the app is not installed and if I turn minifyEnabled to false to make the proguard disabled and then make the apk it installs and runs .

this is my gradle :

dependencies {
// Recommended: Add the Firebase SDK for Google Analytics.
implementation 'com.google.firebase:firebase-analytics:17.2.3'
implementation 'com.google.firebase:firebase-crashlytics:17.0.0-beta01'

implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"

implementation 'com.android.support:multidex:1.0.3'

implementation 'androidx.appcompat:appcompat:1.2.0-alpha01'
implementation 'androidx.recyclerview:recyclerview:1.2.0-alpha01'
implementation 'androidx.cardview:cardview:1.0.0-alpha01'
implementation 'com.google.android.material:material:1.2.0-alpha01'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta4'

implementation('cn.trinea.android.view.autoscrollviewpager:android-auto-scroll-view-pager:1.1.2') {
    exclude module: 'support-v4'
}
implementation 'com.github.bumptech.glide:glide:4.9.0'
implementation 'com.github.shell-software:fab:1.1.2'
implementation 'com.alirezaafkar:sundatepicker:2.0.8'
implementation 'me.dm7.barcodescanner:zxing:1.9'
implementation 'com.google.android.gms:play-services-maps:17.0.0'
implementation 'com.google.android.gms:play-services-gcm:17.0.0'
implementation 'com.google.android.gms:play-services-location:17.0.0'

implementation 'com.google.firebase:firebase-core:17.2.3'
implementation 'com.google.firebase:firebase-messaging:20.1.2'

implementation 'com.nineoldandroids:library:2.4.0'
implementation 'com.daimajia.slider:library:1.1.5@aar'
implementation 'com.squareup.picasso:picasso:2.5.2'

implementation 'com.github.MikeOrtiz:TouchImageView:2.2.0' // Android X

}

this is my proguard :

    -keep class org.apache.http.** { *; }
-keep class org.apache.commons.codec.** { *; }
-keep class org.apache.commons.logging.** { *; }
-keep class android.net.compatibility.** { *; }
-keep class android.net.http.** { *; }
-keep class javax.annotation.**{*;}
-dontwarn javax.annotation.**
-dontwarn org.apache**

-keep public class android.net.http.SslError
-keep public class android.webkit.WebViewClient
-dontwarn android.webkit.WebView
-dontwarn android.net.http.SslError
-dontwarn android.webkit.WebViewClient

-keep class cn.trinea.android.** { *; }
-keepclassmembers class cn.trinea.android.** { *; }
-dontwarn cn.trinea.android.**

-dontwarn com.squareup.picasso.**

-keep class com.parse.**{*;}
-dontwarn com.parse.**
-keep class org.slf4j.**{*;}
-assumenosideeffects class android.util.Log {
                            public static boolean isLoggable(java.lang.String, int);
                            public static int v(...);
                            public static int i(...);
                            public static int w(...);
                            public static int d(...);
                            public static int e(...);
                        }

-keep class cn.trinea.android.** { *; }
-keepclassmembers class cn.trinea.android.** { *; }
-dontwarn cn.trinea.android.**
-dontwarn org.slf4j.**

-keep public class com.google.android.gms.* { public *; }
-keep class com.google.android.gms.* { *; }
-keep class com.google.* {  *; }
-dontwarn com.google.**

-keep class com.crashlytics. { *; }
-dontwarn com.crashlytics.
-keep class io.fabric.sdk.android. { *; }
-dontwarn io.fabric.sdk.android.
-keep class com.crashlytics.android. { *; }
-dontwarn com.crashlytics.android.

-keepattributes *Annotation*
-keepattributes SourceFile,LineNumberTable
-keep public class * extends java.lang.Exception
-keep class com.crashlytics.** { *; }
-dontwarn com.crashlytics.**

-keep class com.analytics.** { *; }
-dontwarn com.analytics.**
-keep class com.crashlytics.** { *; }
-dontwarn com.crashlytics.**

-keep class com.firebase.** { *; }
-keep class org.apache.** { *; }

is there any way to make android studio return the errors before building the apk or any other way that I can find out why it is not installing when the proguard is enabled ?

I also had the same issue. I was generating an unsigned APK of the app (without a key and certificates). However, when I generated a signed APK, everything worked fine. You can try that.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM