我有我正在使用AAR文件的主要Android項目中使用的庫項目。現在我已經預料到了着名的65k方法限制,但我沒有多少疑問。Android庫項目中的方法引用太多 - ClassNotFoundException
我在我的主要項目的libs文件夾添加AAR文件和編譯的build.gradle相同。
1)我需要在這兩個庫中添加多DEX支持,以及主要的Android項目?
2)我需要在這兩個項目中添加afterEvaluate腳本?
最重要的是,如果我們得到了multi-dex工作,我們可能會得到一個問題,即在主android工程中,如果我們嘗試使用的任何類不在主dex列表中,我們將得到Classnotfound異常。
編輯: - 我想保持張貼根據我的測試,以便任何人誰有任何想法可以幫助我們所有的更新。在項目中使用
依賴關係: -
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:22.2.1'
compile 'com.google.android.gms:play-services-gcm:7.8.0'
compile 'com.google.android.gms:play-services-location:7.8.0'
compile 'com.google.android.gms:play-services-ads:7.8.0'
compile 'co.pointwise:pw-proto:0.0.5'
compile 'com.amazonaws:aws-android-sdk-sns:2.2.1'
compile 'com.amazonaws:aws-android-sdk-core:2.2.1'
compile 'com.github.tony19:logback-android-core:1.1.1-4'
compile 'com.github.tony19:logback-android-classic:1.1.1-4'
compile 'org.slf4j:slf4j-api:1.7.6'
compile 'com.android.support:multidex:1.0.0'
compile(name: 'sdk-debug', ext: 'aar') // my library project
// Crashlytics Kit
compile('com.crashlytics.sdk.android:crashlytics:[email protected]') {
transitive = true
}
}
17-08-2015 - 按照文件我修改我的代碼和它現在的工作,但我無法生成APK簽署與ProGuard的。
Proguard的文件看起來像: -
-keep class ch.qos.** { *; }
-keep class org.slf4j.** { *; }
-keep class io.protostuff.** { *; }
-keep class com.google.common.** { *; }
-keep com.amazonaws.http.** { *; }
-keep com.amazonaws.internal.** { *; }
-keepattributes *Annotation*
-keep class * extends java.util.ListResourceBundle {
protected Object[][] getContents();
}
# Keep SafeParcelable value, needed for reflection. This is required to support backwards
# compatibility of some classes.
-keep public class com.google.android.gms.common.internal.safeparcel.SafeParcelable {
public static final *** NULL;
}
# Keep the names of classes/members we need for client functionality.
-keepnames @com.google.android.gms.common.annotation.KeepName class *
-keepclassmembernames class * {
@com.google.android.gms.common.annotation.KeepName *;
}
# Needed for Parcelable/SafeParcelable Creators to not get stripped
-keepnames class * implements android.os.Parcelable {
public static final ** CREATOR;
}
錯誤: -
Warning: com.amazonaws.AmazonWebServiceClient: can't find referenced class org.apache.commons.logging.LogFactory
Warning: ch.qos.logback.core.net.SMTPAppenderBase: can't find referenced class javax.mail.internet.MimeMessage
Warning: com.google.common.base.Absent: can't find referenced class javax.annotation.Nullable
Warning: there were 1406 unresolved references to classes or interfaces.
You may need to add missing library jars or update their versions.
If your code works fine without the missing classes, you can suppress
the warnings with '-dontwarn' options.
(http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedclass)
Warning: there were 9 unresolved references to program class members.
Your input classes appear to be inconsistent.
You may need to recompile the code.
(http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedprogramclassmember)
:app:proguardProdRelease FAILED
我所面臨的問題,前面還有,我是不是能夠解決它的最後一個項目,但這次我需要解決它。
任何想法?
是的,我跟着文件和它的工作,但無法生成釋放apk。我更新了我的問題。 – Scorpion
@Scorpion你能用依賴關係列表更新你的問題嗎?你在使用哪個亞馬遜圖書館? –
我用依賴關係更新了它。 – Scorpion