android - 在工作室中使用混淆器时找不到符号方法

标签 android android-studio android-proguard

我在 strudio 中创建了一个应用程序并在其中添加了一个模块,我正在尝试在该模块中使用混淆器。

但我在构建我的应用程序时确实遇到了以下错误。

enter image description here

下面是proguard-rules.procom.jsondb是我自己的类

-keep class com.bluelinelabs.logansquare.** { *; }
-keep @com.bluelinelabs.logansquare.annotation.JsonObject class *
-keep class **$$JsonObjectMapper { *; }

-keep class io.realm.annotations.RealmModule
-keep @io.realm.annotations.RealmModule class *
-keep class io.realm.internal.Keep
-keep @io.realm.internal.Keep class * { *; }
-dontwarn javax.**
-dontwarn io.realm.**

-keep public class com.jsondb.db.DB { *; }
-keep public class com.jsondb.db.model { *; }
-keep public class com.jsondb.rest.RestApi { *; }
-keep public class com.jsondb.rest.RestApiCallback { *; }

以下是module的build.gradle

apply plugin: 'com.android.library'
apply plugin: 'com.neenbedankt.android-apt'
android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"

    defaultConfig {
        minSdkVersion 19
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    apt 'com.bluelinelabs:logansquare-compiler:1.3.4'
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.1.1'
    compile 'com.squareup.retrofit2:retrofit:2.0.0-beta3'
    compile 'com.github.aurae.retrofit2:converter-logansquare:1.2.1'
    compile 'com.bluelinelabs:logansquare:1.3.4'
    compile 'io.realm:realm-android:0.87.4'
}

最佳答案

我通过添加缺少的模型类解决了这个问题

-keep public class com.jsondb.model.user.** {*; }

关于android - 在工作室中使用混淆器时找不到符号方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35911025/

相关文章:

android-studio - 首选项库导致 E/libc & E/Pref 错误

Android BottomNavigationView 禁用图标标题

android - 禁用 ListView 的项目 - 我的代码出现异常

android - Sugar ORM 中的 SugarContext.init(this) 是什么

android - 我可以编写可以在 WebAssembly 以及 Android 和 iOS 上运行的 Rust 代码吗?

java - 我无法在使用 android 中的 java 的 Retrofit2 调用中接收响应无法解析模型中的响应

安卓/java : Transition/Migration from ProGuard to R8?

android - 如何在android studio中混淆包名

android - AAR 被 ProGuard 混淆时有占位符,导致失败

android - 在 Play 商店中上传 bundle 出现错误