/ /ライブラリプロジェクトでproguadを使用する方法AndroidStudio-android、android-studio、proguard

ライブラリプロジェクトでのProguadの使い方Android Studio - android、android-studio、proguard

proguardを正しく動作させることができましたが、問題は、プロジェクト内にライブラリプロジェクトがあるため、proguardが魔法をかけると、ライブラリがクラスを認識しないことです(その逆も同様です)。

ライブラリプロジェクトがある場合、proguardを正しく使用するにはどうすればよいですか?両方のプロジェクトを相互にリンクさせる方法」クラスを正しく保持するには? どんな助けでも大いに感謝されている人です。

これが私のアプリのビルドファイルです:

apply plugin: "com.android.application"

android {
compileSdkVersion 21
buildToolsVersion "21.1.2"

defaultConfig {



applicationId "com.ex.test"
minSdkVersion 14
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
}
}
packagingOptions {
exclude "META-INF/LICENSE"
exclude "META-INF/LICENSE-FIREBASE.txt"
exclude "META-INF/NOTICE"
}

}


dependencies {
compile fileTree(include: ["*.jar"], dir: "libs")
compile "com.android.support:appcompat-v7:21.0.2"
compile "com.android.support:cardview-v7:21.0.2"
compile "com.android.support:recyclerview-v7:21.0.2"
compile "com.mcxiaoke.volley:library:1.0.+"
compile "com.android.support:support-annotations:21.0.2"
compile "com.android.support:support-v4:21.0.2"
compile project(":chatinglibrary")
compile "com.squareup.picasso:picasso:2.4.0"
compile "com.google.android.gms:play-services:6.5.87"
compile "com.koushikdutta.ion:ion:2.+"
compile "com.github.amlcurran.showcaseview:library:5.0.0"
compile "com.afollestad:material-dialogs:0.7.6.0"
}

そしてここに私のlibのビルドファイルがあります:

apply plugin: "com.android.library"

android {
compileSdkVersion 21
buildToolsVersion "21.1.2"

defaultConfig {
minSdkVersion 14
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
}
}
}

dependencies {
compile fileTree(dir: "libs", include: ["*.jar"])
compile "com.android.support:appcompat-v7:21.0.3"
compile "com.firebase:firebase-client-android:2.0.3+"
}

回答:

回答№1は0

各ライブラリをこのように保護しないようにする必要があります

   -keep class android.support.v4.app.** { *; }
-keep interface android.support.v4.app.** { *; }

一部のライブラリには、proguadから守るための特別なルールがあります

例を参照してください

そしてこの答えを見てください