2016-03-26 11 views
1

私のAndroidアプリはGoogleマップを使用しており、SDK23とSDK19の両方のデバイスで正常にコンパイルできます。 SDK23(LGのG4)の罰金それを実行しますが、このエラーSDK19デバイスを生成する(サムスンギャラクシー4)=> java.lang.NoClassDefFoundErrorが:com.google.android.gms.R $文字列

これらは私の依存関係です: Android Studio Dependencies

私のマニフェストファイル:私はこのエラーを探したとき、私は私のアプリのコンパイルなぜソリューションは/答えを見つけることができませんでした

<?xml version="1.0" encoding="utf-8"?> 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
package="com.example.volkerpetersen.sailingrace"> 
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> 
<uses-permission android:name="android.permission.INTERNET" /> 
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> 
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> 
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" /> 

<uses-feature 
    android:glEsVersion="0x00020000" 
    android:required="true"></uses-feature> 

<application 
    android:name=".GlobalParameters" 
    android:allowBackup="true" 
    android:icon="@mipmap/ic_launcher" 
    android:label="@string/app_name" 
    android:theme="@style/Theme.AppCompat"> 
    <activity 
     android:name=".MainActivity" 
     android:label="@string/app_name" 
     android:theme="@android:style/Theme.Holo.Light.DarkActionBar"> 
     <intent-filter> 
      <action android:name="android.intent.action.MAIN" /> 
      <category android:name="android.intent.category.LAUNCHER" /> 
     </intent-filter> 
    </activity> 
    <activity 
     android:name=".start_timerActivity" 
     android:label="@string/title_activity_start_timer" 
     android:parentActivityName=".MainActivity" 
     android:windowSoftInputMode="stateHidden" 
     android:screenOrientation="portrait"> 
     <meta-data 
      android:name="android.support.PARENT_ACTIVITY" 
       android:value="com.example.volkerpetersen.sailingrace.MainActivity" /> 
    </activity> 
    <activity 
     android:name=".start_raceActivity" 
     android:label="@string/title_activity_start_race" 
     android:parentActivityName=".MainActivity" 
     android:theme="@android:style/Theme.Holo.NoActionBar" > 
     <meta-data 
      android:name="android.support.PARENT_ACTIVITY" 
     android:value="com.example.volkerpetersen.sailingrace.MainActivity" /> 
    </activity> 
    <activity 
     android:name=".start_mapActivity" 
     android:label="@string/title_activity_start_map" 
     android:theme="@android:style/Theme.Holo.Light.DarkActionBar"> 
     <meta-data 
      android:name="android.support.PARENT_ACTIVITY" 
      android:value="com.example.volkerpetersen.sailingrace.MainActivity" /> 
    </activity> 
    <activity 
     android:name=".SailingRacePreferences" 
     android:screenOrientation="portrait" 
     android:label="@string/title_activity_setting" 
     android:noHistory="true" 
     android:parentActivityName=".MainActivity" 
     android:theme="@android:style/Theme.Holo.Light.DarkActionBar"> 
     <meta-data 
      android:name="android.support.PARENT_ACTIVITY" 
      android:value="com.example.volkerpetersen.sailingrace.MainActivity" /> 
    </activity> 

    <receiver android:name=".SailTimerAPI"></receiver> 

    <!-- 
     The API key for Google Maps-based APIs is defined as a string resource using the <meta-data> tag 
     (See the file "res/values/google_maps_api.xml"). 
     Note that the API key is linked to the encryption key used to sign the APK. 
     You need a different API key for each encryption key, including the release key that is used to 
     sign the APK for publishing. 
     You can define the keys for the debug and release targets in src/debug/ and src/release/. 
    --> 
    <meta-data 
     android:name="com.google.android.maps.v2.API_KEY" 
     android:value="AIzaSyDzCAa-hibdRJ-NdOnIRK-IG5uN2U3kv9c" /> 
    <meta-data 
     android:name="com.google.android.gms.version" 
     android:value="@integer/google_play_services_version" /> 

    <!-- original code replaced with above 
    <meta-data 
     android:name="com.google.android.gms.version" 
     android:value="@integer/google_play_services_version" /> 
    --> 

</application> 

は/ SDK23下細かい動作しますが、このランを生成し、 SDK19の時エラーです。

ご協力いただければ幸いです!

答えて

0

最後に、この問題を解決しました。

私は コンパイルからマニフェストをダウングレードするために必要な「com.google.android.gms:-サービスを再生:8.4.0」 を古いバージョン コンパイル「com.google.android.gmsへ:-サービスを再生します:両方のデバイス上のデバイスソフトウェアとの互換性を確保するために、8.3.0 '

このアプリケーションは、SDK19とSDK23の電話機で動作します。正しい方向に私を指してくれてありがとうMounir。とても有難い!

+0

あなたを助けてくれることを歓迎します。あなたの答えを他の人を助ける正しい答えとして記入してください。 –

0

プロジェクトをきれいにしようとした後、あなたのアプリケーションのGradle 2つの最後の依存関係から削除してください:プレー-サービスは、アイデンティティをGCM

+0

このチップをありがとう。それは私にさらに一歩足を踏み入れました。 アプリが起動しましたが、マップフラグメントを起動しようとするとエラーメッセージが表示されます。エラーメッセージ:「GooglePlayServiceUtil:古いGoogle Playサービスです.848700が必要ですが、8301038が見つかりました」 これの助け? –

+0

ターゲットとなるSDKは何ですか?あなたのアプリケーションモジュールのbuild.gradleを表示してください –

関連する問題