Super.onCreate (savedInstanceState) fails on first run
Exception thrown by Firebase Crash Reporting:
Exception java.lang.RuntimeException: Unable to start Activity ComponentInfo {com.talmir.mickinet / com.talmir.mickinet.activities.HomeActivity}: android.content.res.Resources $ NotFoundException: Resource ID 0x7f080058 android.app.ActivityThreadctivity.performLaunchLaunchActivity ActivityThread.java:2249) android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:2299) android.app.ActivityThread.access $ 700 (ActivityThread.java:154) android.app.ActivityThread $ H.handleMessage ...
Android.content.res.Resources $ NotFoundException is thrown: Resource ID 0x7f080058 android.content.res.Resources.getValue (Resources.java:1883) android.support.v7.widget.AppCompatDrawableManager.c (SourceFile: 332) android.support. v7.widget.AppCompatDrawableManager.a (SourceFile: 197) android.support.v7.widget.AppCompatDrawableManager.getDrawable ...
HomeActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_home); // line 238
FirebaseCrash.log("HomeActivity");
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M)
if (!canAccessCamera() || !canAccessExternalStorage() || !canAccessContacts())
requestPermissions(INITIAL_PERMISSIONS, INITIAL_REQUEST);
copyRawFile(R.raw.file_receive);
// other codes...
activity_home.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_home"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
tools:context="com.talmir.mickinet.activities.HomeActivity"
android:background="@color/snow">
<fragment
android:id="@+id/frag_list"
class="com.talmir.mickinet.fragments.DeviceListFragment"
android:layout_width="match_parent"
android:layout_height="@dimen/phone_list_height">
</fragment>
<fragment
android:id="@+id/frag_detail"
class="com.talmir.mickinet.fragments.DeviceDetailFragment"
android:layout_width="match_parent"
android:layout_height="match_parent">
</fragment>
</RelativeLayout>
AndroidManifest.xml
<activity
android:name=".activities.HomeActivity"
android:configChanges="orientation|keyboardHidden"
android:screenOrientation="portrait"
android:theme="@style/AppTheme"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
build.gradle
apply plugin: 'com.android.application'
android {
signingConfigs {
config {
// my config
}
}
compileSdkVersion 25
buildToolsVersion "25.0.3"
defaultConfig {
applicationId "com.talmir.mickinet"
minSdkVersion 17
targetSdkVersion 25
versionCode 1
versionName "1.0"
vectorDrawables.useSupportLibrary = true
signingConfig signingConfigs.config
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
debuggable false
jniDebuggable false
signingConfig signingConfigs.config
renderscriptDebuggable false
zipAlignEnabled true
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.android.support:support-v4:25.3.1'
compile 'com.android.support:cardview-v7:25.3.1'
compile 'com.android.support:recyclerview-v7:25.3.1'
compile 'com.github.paolorotolo:appintro:4.1.0'
compile 'com.android.support:support-vector-drawable:25.3.1'
implementation 'com.google.firebase:firebase-crash:11.0.2'
}
apply plugin: 'com.google.gms.google-services'
I tested: the this ,,, the this one's (s). The question in this link looks closer to my problem than others.
Moreover, the same app installed in API 23 and API 17 (both are physical devices), but the error only occurs in API 17 (at startup).
Basic question:
Why is this exception happening and how can I resolve it?
source to share
This exception happens to me when I upgrade Android Studio from Canary 5 to canary 6
I go back to Android Studio 2.3.2 and changed the classpath to Gradle 2.3.2 and the problem was resolved.
Update: I tried with three of my apps and got the same error but resolved it as described.
source to share
I also had the same problem today. After some research, I found this:
android.enableAapt2=false
Add this line to your gradle.properties file.
Link here .
I think it is caused by a bug in the latest version (3.0 Canary 6) of Android Studio.
Improved handling of incremental resources using AAPT2. To enable AAPT2 add the following to your gradle.properties file: android.enableAapt2 = true
The text above is in the android studio preview link .
source to share