remedy. remedy. - 5 months ago 63
Android Question

Android Resource Unable to find resource ID #0x7f070024

This has been the first time I've ever encountered an issue like this and I'm a bit dumbfounded by it. My problem is whenever I debug my application, everything is all fine and dandy, but as soon as I generate an apk and distribute it through crashlytics to my beta testers, all hell breaks lose and I'm thrown this

Resources$NotFoundExeption
.

I checked my
R.java
file for resource
0x7f070024
and found that it shows this:

public static final int common_google_play_services_unknown_issue=0x7f070024;


This didn't mean like much to me. I then proceeded to the other string resource error which was pointing to resource id
0x7f070036
which shows me:

public static final int app_name=0x7f070036;


I checked the usage of this variable and the only place that I'm using this string resource is inside the
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>


Just to complete this question, let me add my gradle files as they may be important to solving this problem:

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:2.5.7@aar') {
transitive = true;
}
compile('com.mapbox.mapboxsdk:mapbox-android-sdk:4.1.0-beta.2@aar') {
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'
}
}


What am I missing? What am I doing incorrectly?

Logcat files will be added here just incase:

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)

Answer

I've got the similar issue with

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

I tried with clean project, rebuild project, invalidate Android Studio cache. Still no luck /_\

But when I changed to

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

The problem disappeared. Same code! All other settings same!

I think it was a bug in gradle build 2.2.0-alpha3

Always got problems with gradle alpha...