super.onCreate(savedInstanceState) crashes on first run
Exceptions caught by Firebase crash reports:
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.ActivityThread.performLaunchActivity (ActivityThread.java:2249)
android.app.ActivityThread.handleLaunchActivity
(ActivityThread.java:2299) android.app.ActivityThread.access$700
(ActivityThread.java:154) android.app.ActivityThread$H.handleMessage
…Caused by android.content.res.Resources$NotFoundException: 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'
What I tested:
this , this , this , this). the issue in this link looks closer to mine than others.
Also, the same application is installed in API 23 and API 17 (both physical devices), but only with the error in API 17 (on startup).
Main question:
Why is this exception occurring and how do I fix it?
Solution
This exception occurs when I update Android Studio from Canary 5 to Canary 6
I went back to Android Studio 2.3.2 and
changed the classpath back to Gradle 2.3.2 and the problem was solved.
Update: I tried my 3 apps and I got the same error but solved it as described.