2017-07-26 139 views
0

我的第一个问题(希望我能解决它)Proguard的混淆工程Android Studio中

  • Proguard的,我有几个错误吧
  • 我的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' 

= - = - = - = - = 和我的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 *; 
#} 

= - = - = - = - = 后,现在建立了产生签名的.apk我得到这个 (也有照片检查出来)

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

回答

0

添加

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

您的proguard规则。无耻地从here盗走

+0

它的成功Succesfully Thx,:) –