Jeff Johnson
Jeff Johnson

Reputation: 49

Unable to instantiate activity Error

Hi im trying to sample a code and I get this error which I posted down below. I read about it and it seems like it's an error when a activity of mine is not declared in the android manifest, but I did put all of them in there.

java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.schwarzerritter.remotecontroll/com.example.schwarzerritter.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "com.example.schwarzerritter.MainActivity" on path: DexPathList[[zip file "/data/app/com.example.schwarzerritter.remotecontroll-1/base.apk", zip file "/data/app/com.example.schwarzerritter.remotecontroll-1/split_lib_dependencies_apk.apk", zip file "/data/app/com.example.schwarzerritter.remotecontroll-1/split_lib_slice_0_apk.apk", zip file "/data/app/com.example.schwarzerritter.remotecontroll-1/split_lib_slice_1_apk.apk", zip file "/data/app/com.example.schwarzerritter.remotecontroll-1/split_lib_slice_2_apk.apk", zip file "/data/app/com.example.schwarzerritter.remotecontroll-1/split_lib_slice_3_apk.apk", zip file "/data/app/com.example.schwarzerritter.remotecontroll-1/split_lib_slice_4_apk.apk", zip file "/data/app/com.example.schwarzerritter.remotecontroll-1/split_lib_slice_5_apk.apk", zip file "/data/app/com.example.schwarzerritter.remotecontroll-1/split_lib_slice_6_apk.apk", zip file "/data/app/com.example.schwarzerritter.remotecontroll-1/split_lib_slice_7_apk.apk", zip file "/data/app/com.example.schwarzerritter.remotecontroll-1/split_lib_slice_8_apk.apk", zip file "/data/app/com.example.schwarzerritter.remotecontroll-1/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]

Here my Manifest xml file

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.schwarzerritter.remotecontroll">

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="Remotecontroll"
    android:roundIcon="@mipmap/ic_launcher_round"
    android:supportsRtl="true"
    android:theme="@style/AppTheme">

    <activity
        android:name="com.example.schwarzerritter.MainActivity"
        android:label="@string/app_name"
        android:theme="@style/AppTheme.NoActionBar"
        android:screenOrientation="sensorPortrait">

        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity android:name=".Navigation" />
    <activity android:name=".Car_doors" />
    <activity android:name=".Air_con_fill_gas"/>
</application>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>

</manifest>

Upvotes: 0

Views: 57

Answers (1)

Muthukrishnan Rajendran
Muthukrishnan Rajendran

Reputation: 11622

change your PackageName for MainActivity in activity tag

<activity  

        android:name="com.example.schwarzerritter.remotecontroll.MainActivity"
        android:label="@string/app_name"
        android:theme="@style/AppTheme.NoActionBar"
        android:screenOrientation="sensorPortrait">

        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
</activity>

Upvotes: 1

Related Questions