2016-06-21 132 views
0

這是我第一次遇到這樣的問題,我有點傻了。我的問題是每當我調試我的應用程序時,一切都很好,並且很花哨,但是一旦我生成一個apk並通過crashlytics分發給我的beta測試者,所有地獄破解都會丟失,並且我被拋出了這個Resources$NotFoundExeptionAndroid資源無法找到資源ID#0x7f070024

我檢查了我的R.java文件資源0x7f070024,發現它顯示了這一點:

public static final int common_google_play_services_unknown_issue=0x7f070024; 

這並不意味着不太像我。我接着向其中指向資源ID 0x7f070036其另一個字符串資源錯誤表明我:

public static final int app_name=0x7f070036; 

我檢查這個變量的使用情況和我使用這個字符串資源的唯一地方是裏面的AndroidManifest.xml

<application 
    android:name=".MyApplication" 
    android:allowBackup="true" 
    android:icon="@mipmap/ic_launcher" 
    android:label="@string/app_name"  //**HERE** 
    android:theme="@style/AppTheme"> 
    <meta-data 
     android:name="com.google.android.gms.version" 
     android:value="@integer/google_play_services_version"/> 
    <meta-data 
     android:name="io.fabric.ApiKey" 
     android:value="blablablah"/> 

    <activity 
     android:name=".views.activities.LoginActivity" 
     android:configChanges="keyboard|keyboardHidden" 
     android:screenOrientation="portrait"> 
     <intent-filter android:label="@string/app_name"> //**HERE** 
      <action android:name="android.intent.action.MAIN"/> 
      <category android:name="android.intent.category.LAUNCHER"/> 
     </intent-filter> 
    </activity> 

只是爲了完成這個問題,讓我補充我的gradle這個文件,因爲它們可能會解決這個問題的重要:

compileSdkVersion 23 
buildToolsVersion "23.0.2" 

defaultConfig { 
    applicationId "helpme.jesus" 
    minSdkVersion 16 
    targetSdkVersion 23 
    versionCode 1 
    versionName "1.0" 
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 
} 

dependencies { 
    compile fileTree(include: ['*.jar'], dir: 'libs') 
    compile 'com.android.support:appcompat-v7:23.1.0' 
    compile 'com.jakewharton:butterknife:7.0.1' 
    compile 'com.squareup.retrofit:retrofit:1.9.0' 
    compile 'com.google.android.gms:play-services-gcm:8.4.0' 
    compile 'com.android.support:support-v4:21.0.+' 
    compile 'com.android.support:design:23.1.0' 
    compile 'de.greenrobot:greendao:2.0.0' 
    compile 'com.squareup:otto:1.3.8' 
    compile 'com.squareup.dagger:dagger:1.2.2' 
    compile 'com.birbit:android-priority-jobqueue:1.3.5' 
    compile 'com.android.support:cardview-v7:23.1.0' 
    compile 'com.android.support:recyclerview-v7:23.1.0' 
    compile 'com.google.zxing:core:3.2.1' 
    compile('com.crashlytics.sdk.android:crashlytics:[email protected]') { 
     transitive = true; 
    } 
    compile('com.mapbox.mapboxsdk:mapbox-android-sdk:[email protected]') { 
     transitive = true 
    } 
    apt 'com.squareup.dagger:dagger-compiler:1.2.2' 

} 

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

buildscript { 
    repositories { 
     jcenter() 
    } 
    dependencies { 
     classpath 'com.android.tools.build:gradle:2.2.0-alpha3' 
     classpath 'com.neenbedankt.gradle.plugins:android-apt:1.4' 
     classpath 'com.google.gms:google-services:2.0.0-alpha5' 
    } 
} 

我在想什麼?我做錯了什麼?

logcat的文件將在這裏只是櫃面添加:

06-21 18:28:37.171 25824-25824/? E/AndroidRuntime: FATAL EXCEPTION: main 
               Process: dev.helpme.jesus, PID: 25824 
               java.lang.RuntimeException: Unable to get provider com.google.android.gms.measurement.AppMeasurementContentProvider: android.content.res.Resources$NotFoundException: Unable to find resource ID #0x7f070024 
                at android.app.ActivityThread.installProvider(ActivityThread.java:5092) 
                at android.app.ActivityThread.installContentProviders(ActivityThread.java:4669) 
                at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4609) 
                at android.app.ActivityThread.access$1500(ActivityThread.java:151) 
                at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1374) 
                at android.os.Handler.dispatchMessage(Handler.java:102) 
                at android.os.Looper.loop(Looper.java:135) 
                at android.app.ActivityThread.main(ActivityThread.java:5345) 
                at java.lang.reflect.Method.invoke(Native Method) 
                at java.lang.reflect.Method.invoke(Method.java:372) 
                at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:947) 
                at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:742) 
               Caused by: android.content.res.Resources$NotFoundException: Unable to find resource ID #0x7f070024 
                at android.content.res.Resources.getResourcePackageName(Resources.java:2089) 
                at com.google.android.gms.measurement.zza.<init>(Unknown Source) 
                at com.google.android.gms.measurement.zza.zzaR(Unknown Source) 
                at com.google.android.gms.measurement.internal.zzn.zziJ(Unknown Source) 
                at com.google.android.gms.measurement.internal.zzz.zza(Unknown Source) 
                at com.google.android.gms.measurement.internal.zzw.<init>(Unknown Source) 
                at com.google.android.gms.measurement.internal.zzaa.zzDj(Unknown Source) 
                at com.google.android.gms.measurement.internal.zzw.zzaT(Unknown Source) 
                at com.google.android.gms.measurement.AppMeasurementContentProvider.onCreate(Unknown Source) 
                at android.content.ContentProvider.attachInfo(ContentProvider.java:1696) 
                at android.content.ContentProvider.attachInfo(ContentProvider.java:1671) 
                at android.app.ActivityThread.installProvider(ActivityThread.java:5089) 
                at android.app.ActivityThread.installContentProviders(ActivityThread.java:4669)  
                at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4609)  
                at android.app.ActivityThread.access$1500(ActivityThread.java:151)  
                at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1374)  
                at android.os.Handler.dispatchMessage(Handler.java:102)  
                at android.os.Looper.loop(Looper.java:135)  
                at android.app.ActivityThread.main(ActivityThread.java:5345)  
                at java.lang.reflect.Method.invoke(Native Method)  
                at java.lang.reflect.Method.invoke(Method.java:372)  
                at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:947)  
                at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:742)  



06-21 18:28:37.231 533-556/? W/PackageManager: Failure retrieving text 0x7f070036 in package dev.helpme.jesus 
              android.content.res.Resources$NotFoundException: String resource ID #0x7f070036 
               at android.content.res.Resources.getText(Resources.java:299) 
               at android.app.ApplicationPackageManager.getText(ApplicationPackageManager.java:1155) 
               at android.content.pm.PackageItemInfo.loadLabel(PackageItemInfo.java:131) 
               at android.app.ApplicationPackageManager.getApplicationLabel(ApplicationPackageManager.java:1199) 
               at com.android.server.am.AppErrorDialog.<init>(AppErrorDialog.java:48) 
               at com.android.server.am.ActivityManagerService$MainHandler.handleMessage(ActivityManagerService.java:1364) 
               at android.os.Handler.dispatchMessage(Handler.java:102) 
               at android.os.Looper.loop(Looper.java:135) 
               at android.os.HandlerThread.run(HandlerThread.java:61) 
               at com.android.server.ServiceThread.run(ServiceThread.java:46) 
+0

清潔和重建項目 –

+0

檢查res文件夾下的strings.xml檔案。你能看到任何一行,如** 你的應用名稱 ** –

+0

@SathishKumarJ我已經做了很多次。 @AshishKudale我'strings.xml'文件第一行實際上是這樣的: '<字符串名稱=「APP_NAME」>我的應用程序' 我還刪除了'R.java'文件,並重建了應用。 –

回答

2

我有類似的問題與

classpath 'com.android.tools.build:gradle:2.2.0-alpha3' 

我試着用乾淨的項目,改造項目,無效的Android工作室緩存。仍然沒有運氣/ _ \

但是,當我改變

classpath 'com.android.tools.build:gradle:2.1.2' 

問題就消失了。相同的代碼!所有其他設置相同!

我認爲這是在建立的gradle 2.2.0-素α3的錯誤

始終得到了與阿爾法gradle這個問題......

+1

是的!這是解決方案。浪費無數小時!我從來沒有想過改變這一點。謝啦! –

+0

歡迎! :) 我認爲人們也遭受同樣的問題。看起來下一個版本會解決它。 https://code.google.com/p/android/issues/detail?id=210467 – OnJohn