简体   繁体   中英

Proguard obfuscation Project in Android Studio

My first question (hope i Can Solve it)

  • Proguard i have Several Error with it
  • My Build.Gradle (App)

=--=-=-=-=-=-=-=-

apply plugin: 'com.android.application'
apply plugin: 'org.greenrobot.greendao'

android {
    compileSdkVersion 25
    buildToolsVersion '26'
    defaultConfig {
        applicationId "com.navigator.byiaaamh.navi"
        minSdkVersion 16
        targetSdkVersion 25
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

    multiDexEnabled true
}

dexOptions {
    jumboMode = true

    // Avoid the OutOfMemoryError: GC overhead limit exceeded:
    incremental true
    javaMaxHeapSize "4g"
}

buildTypes {
    release {
        minifyEnabled true
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}


greendao {
    schemaVersion 1
}
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })

// greendao



compile 'com.android.support:appcompat-v7:25.2.0'
compile 'com.android.support.constraint:constraint-layout:1.0.0-beta4'
compile 'com.android.support:multidex:1.0.1'
compile 'org.greenrobot:greendao:3.2.0'
compile 'com.google.firebase:firebase-messaging:11.0.2'
compile 'com.google.android.gms:play-services-ads:11.0.2'

}

apply plugin: 'com.google.gms.google-services'

=--=-=-=-= And My proguard-rules.pro

    # Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in C:\Users\Hemo\AppData\Local\Android\Sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
#   http://developer.android.com/guide/developing/tools/proguard.html

# Add any project specific keep options here:

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
#   public *;
#}

=-=-=-=-= Now After Build Generate Signed Apk i got this (also have Photo To check it out)

    Information:Gradle tasks [:app:assembleRelease]
Warning:The `android.dexOptions.incremental` property is deprecated and it has no effect on the build process.
Warning:org.greenrobot.greendao.database.DatabaseOpenHelper$EncryptedHelper: can't find superclass or interface net.sqlcipher.database.SQLiteOpenHelper
Warning:org.greenrobot.greendao.rx.RxQuery$3: can't find superclass or interface rx.Observable$OnSubscribe
Warning:org.greenrobot.greendao.rx.RxUtils$1: can't find superclass or interface rx.functions.Func0
Warning:org.greenrobot.greendao.AbstractDao: can't find referenced class rx.schedulers.Schedulers
Warning:org.greenrobot.greendao.AbstractDaoSession: can't find referenced class rx.schedulers.Schedulers
Warning:org.greenrobot.greendao.database.DatabaseOpenHelper: can't find referenced method 'net.sqlcipher.database.SQLiteDatabase getReadableDatabase(java.lang.String)' in program class org.greenrobot.greendao.database.DatabaseOpenHelper$EncryptedHelper
Warning:org.greenrobot.greendao.database.DatabaseOpenHelper: can't find referenced method 'net.sqlcipher.database.SQLiteDatabase getWritableDatabase(char[])' in program class org.greenrobot.greendao.database.DatabaseOpenHelper$EncryptedHelper
Warning:org.greenrobot.greendao.database.DatabaseOpenHelper: can't find referenced method 'net.sqlcipher.database.SQLiteDatabase getReadableDatabase(char[])' in program class org.greenrobot.greendao.database.DatabaseOpenHelper$EncryptedHelper
Warning:org.greenrobot.greendao.database.DatabaseOpenHelper$EncryptedHelper: can't find referenced class net.sqlcipher.database.SQLiteOpenHelper
Warning:org.greenrobot.greendao.database.DatabaseOpenHelper$EncryptedHelper: can't find referenced class net.sqlcipher.database.SQLiteDatabase
Warning:org.greenrobot.greendao.database.DatabaseOpenHelper$EncryptedHelper: can't find referenced class net.sqlcipher.database.SQLiteOpenHelper
Warning:org.greenrobot.greendao.database.DatabaseOpenHelper$EncryptedHelper: can't find referenced class net.sqlcipher.database.SQLiteDatabase
Warning:org.greenrobot.greendao.database.DatabaseOpenHelper$EncryptedHelper: can't find referenced class net.sqlcipher.database.SQLiteDatabase$CursorFactory
Warning:org.greenrobot.greendao.database.DatabaseOpenHelper$EncryptedHelper: can't find referenced class net.sqlcipher.database.SQLiteDatabase
Warning:org.greenrobot.greendao.database.EncryptedDatabase: can't find referenced class net.sqlcipher.database.SQLiteDatabase
Warning:org.greenrobot.greendao.database.EncryptedDatabaseStatement: can't find referenced class net.sqlcipher.database.SQLiteStatement
Warning:org.greenrobot.greendao.query.Query: can't find referenced class rx.schedulers.Schedulers
Warning:org.greenrobot.greendao.rx.RxBase: can't find referenced class rx.Observable
Warning:org.greenrobot.greendao.rx.RxBase: can't find referenced class rx.Scheduler
Warning:org.greenrobot.greendao.rx.RxBase: can't find referenced class rx.Observable
Warning:org.greenrobot.greendao.rx.RxDao: can't find referenced class rx.Scheduler
Warning:org.greenrobot.greendao.rx.RxDao: can't find referenced class rx.Observable
Warning:org.greenrobot.greendao.rx.RxDao: can't find referenced class rx.Scheduler
Warning:org.greenrobot.greendao.rx.RxQuery: can't find referenced class rx.Observable
Warning:org.greenrobot.greendao.rx.RxQuery: can't find referenced class rx.Observable$OnSubscribe
Warning:org.greenrobot.greendao.rx.RxQuery: can't find referenced class rx.Scheduler
Warning:org.greenrobot.greendao.rx.RxQuery: can't find referenced class rx.Observable
Warning:org.greenrobot.greendao.rx.RxQuery: can't find referenced class rx.Scheduler
Warning:org.greenrobot.greendao.rx.RxQuery$3: can't find referenced class rx.Subscriber
Warning:org.greenrobot.greendao.rx.RxQuery$3: can't find referenced class rx.exceptions.Exceptions
Warning:org.greenrobot.greendao.rx.RxQuery$3: can't find referenced class rx.Subscriber
Warning:org.greenrobot.greendao.rx.RxQuery$3: can't find referenced class rx.Observable$OnSubscribe
Warning:org.greenrobot.greendao.rx.RxQuery$3: can't find referenced class rx.exceptions.Exceptions
Warning:org.greenrobot.greendao.rx.RxQuery$3: can't find referenced class rx.Observable
Warning:org.greenrobot.greendao.rx.RxQuery$3: can't find referenced class rx.Subscriber
Warning:org.greenrobot.greendao.rx.RxQuery$3: can't find referenced class rx.Observable$OnSubscribe
Warning:org.greenrobot.greendao.rx.RxTransaction: can't find referenced class rx.Scheduler
Warning:org.greenrobot.greendao.rx.RxTransaction: can't find referenced class rx.Observable
Warning:org.greenrobot.greendao.rx.RxTransaction: can't find referenced class rx.Scheduler
Warning:org.greenrobot.greendao.rx.RxUtils: can't find referenced class rx.Observable
Warning:org.greenrobot.greendao.rx.RxUtils$1: can't find referenced class rx.Observable
Warning:org.greenrobot.greendao.rx.RxUtils$1: can't find referenced class rx.functions.Func0
Warning:org.greenrobot.greendao.rx.RxUtils$1: can't find referenced class rx.Observable
Warning:org.greenrobot.greendao.rx.RxUtils$1: can't find referenced class rx.functions.Func0
Warning:org.greenrobot.greendao.rx.RxUtils$1: can't find referenced class rx.Observable
Warning:there were 163 unresolved references to classes or interfaces.
Warning:there were 3 unresolved references to program class members.
Warning:Exception while processing task java.io.IOException: Please correct the above warnings first.
Error:Execution failed for task ':app:transformClassesAndResourcesWithProguardForRelease'.
> Job failed, see logs for details
Information:BUILD FAILED
Information:Total time: 6.572 secs
Information:1 error
Information:49 warnings
Information:See complete output in console

=-=-=-

First When i make a Signed Apk

After Finish 1st Error Prove

Add

### greenDAO 3
-keepclassmembers class * extends org.greenrobot.greendao.AbstractDao {
    public static java.lang.String TABLENAME;
 }
 -keep class **$Properties

# If you do not use SQLCipher:
-dontwarn org.greenrobot.greendao.database.**
# If you do not use RxJava:
-dontwarn rx.**

### greenDAO 2
-keepclassmembers class * extends de.greenrobot.dao.AbstractDao {
    public static java.lang.String TABLENAME;
}
-keep class **$Properties

to your proguard rules. Shamelessly stolen from here

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