2017-01-21 6 views
1

私は既存のプロジェクトに2つの異なるAndroidライブラリモジュールを作成しました。アンドロイドライブラリモジュールでパッケージが見つかりません

今、私がこのアプリケーションを実行しようとすると、そのパッケージがプロジェクトに存在しないというエラーが表示されます。これは実際には両方のモジュールが正しい場所にあり、以前はライブラリモジュールが1つしかなかったので、実際はうまくいかず、機能していました。

また、gradle構築中にエラーが発生しません。

apply plugin: 'com.android.application' 

android { 
    compileSdkVersion 23 
    buildToolsVersion "23.0.3" 

    defaultConfig { 
     applicationId "com.cl.lo" 
     minSdkVersion 17 
     targetSdkVersion 23 
     versionCode 1 
     versionName "1.0" 
    } 
    buildTypes { 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 
} 

dependencies { 
    compile fileTree(dir: 'libs', include: ['*.jar']) 
    testCompile 'junit:junit:4.12' 
    compile 'com.android.support:appcompat-v7:23.4.0' 
    compile project(":ge") 
    compile project(":in") 
    compile 'com.mcxiaoke.volley:library-aar:1.0.0' 

} 

この1つはあるのGradleファイル内:

この1つはアプリのGradleのファイルです。

apply plugin: 'com.android.library' 

android { 
    compileSdkVersion 23 
    buildToolsVersion "23.0.3" 

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

dependencies { 
    compile fileTree(dir: 'libs', include: ['*.jar']) 
    testCompile 'junit:junit:4.12' 
    compile 'com.android.support:appcompat-v7:23.4.0' 
    compile 'com.google.android.gms:play-services-maps:9.4.0' 
    compile 'com.google.android.gms:play-services-location:9.4.0' 
    compile 'com.mcxiaoke.volley:library-aar:1.0.0' 
} 

そして最後に、この1つはGEのGradleファイルです:GEのbuild.gradleにこの行を削除して更新

apply plugin: 'com.android.library' 

android { 
    compileSdkVersion 23 
    buildToolsVersion "23.0.3" 

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

dependencies { 
    compile fileTree(dir: 'libs', include: ['*.jar']) 
    testCompile 'junit:junit:4.12' 
    compile 'com.android.support:appcompat-v7:23.4.0' 
    compile 'com.mcxiaoke.volley:library-aar:1.0.0' 
    compile 'com.google.android.gms:play-services-maps:9.4.0' 
} 

答えて

3


minifyEnabled true 

ミニファイアーは、ライブラリで使用されていないコードを削除するため、アプリケーションはそれらを見つけることができません。

NB:ProGuardの設定は、ライブラリbuild.gradleではなく、app build.gradleに設定する必要があります。それはGoogleのサービスに関連する問題がある場合は


旧答え


アプリのbuild.gradleの下部に次の行を追加します。

apply plugin: 'com.google.gms.google-services' 

The Google Services Gradle Plugin

はじめ
2を有効にしているサービスのために必要な基本的なライブラリの依存関係を追加します。この手順では、依存プラグインが導入されないように、適用プラグイン: 'com.google.gms.google-services'の行をapp/build.gradleファイルの一番下に置く必要があります。 ./gradlew:app:dependenciesを実行すると、この手順の結果を確認できます。

+0

Googleサービスの問題ではありません。 – driftking9987

+0

@ driftking9987が私の答えを更新しました。 – Toris

+0

あなたは正しいです、 'minifyEnabled'を削除して、そのトリックをやりました。 sidenoteについては、ライブラリのaarファイルを配布するつもりです。その場合、 'minifyEnabled'はどこで実行すればよいですか? – driftking9987

関連する問題