4

AARファイルを使用してメインのAndroidプロジェクトで使用しているライブラリプロジェクトがあります。有名な 65k メソッドの制限を期待していましたが、クエリはほとんどありません。

メイン プロジェクトの libs フォルダーに AAR ファイルを追加し、同じものを build.gradle にコンパイルしました。

1) ライブラリとメインの Android プロジェクトの両方に multi-dex サポートを追加する必要がありますか?

2) 両方のプロジェクトに afterEvaluate スクリプトを追加する必要がありますか?

最も重要なことは、マルチ dex が機能している場合、使用しようとしているクラスのいずれかがメインの dex リストにない場合、メインの Android プロジェクトで 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:2.5.1@aar') {
        transitive = true
    }
}

2015 年 8 月 17 日 - ドキュメントに従ってコードを修正し、現在は機能していますが、 proguardで署名付き apk を生成できません。

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

以前にも問題に直面しており、前回のプロジェクトでは解決できませんでしたが、今回は解決する必要があります。

何か案は?

4

1 に答える 1