0

I was trying to rename my first android project to something else following the suggestion by Ben in this post. However, even after following the suggestions here to clean up, I get an error when the app is started on my phone (build went fine):

Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER]     cmp=com.impyiablue.stoxx/com.example.alexander.myapplication.MainActivity }
Error type 3
Error: Activity class 

The content of my gradle.build file is as follows:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.1"

    defaultConfig {
        applicationId "com.impyiablue.stoxx"
        minSdkVersion 15
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    dexOptions {
        preDexLibraries = false
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.0.+'
    compile 'com.android.support:design:23.1.0'
    compile 'com.mcxiaoke.volley:library:1.0.19'
}

My Manifest:

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

    <uses-permission android:name="android.permission.INTERNET" />
    <application>
        android:allowBackup="true"
        android:icon="@mipmap/stoxx"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/Theme.AppCompat.Light" />

        <activity
            android:name="com.impyiablue.stoxx.MainActivity"
            android:label="@string/app_name"
            android:theme="@style/AppTheme.NoActionBar" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <activity
            android:name="com.impyiablue.stoxx.NewEntryActivity"
            android:label="@string/menu_add"
            android:theme="@style/AppTheme.NoActionBar"
        />

    </application>

</manifest>

What else do I have to modify so AndroidStudio 'sees' the new name? Or whatever is wrong?

Community
  • 1
  • 1
Alex
  • 41,580
  • 88
  • 260
  • 469
  • 2
    where is your manifest.xml ?? – M D Nov 21 '15 at 10:17
  • added ;-) I changed some content by hand, and some items are shown in red, like `MainActivity`. – Alex Nov 21 '15 at 10:21
  • try to `clean and built` your project – M D Nov 21 '15 at 10:21
  • Same error. Activity class {com.impyiablue.stoxx/com.example.alexander.myapplication.MainActivity} does not exist. – Alex Nov 21 '15 at 10:22
  • If you are using android studio, then try **Invalidate caches and restart** menu and re-build the project – Midhun MP Nov 21 '15 at 10:23
  • Please check [this](http://stackoverflow.com/questions/20915266/error-type-3-error-activity-class-does-not-exist?lq=1) – Zumry Mohamed Nov 21 '15 at 10:28
  • you should also rename the directory of your project on hard disk in case of android studio – Androider Nov 21 '15 at 10:28
  • What directory exactly? The top level directory or the one in src/main/java? – Alex Nov 21 '15 at 10:29
  • @Midhun: I still get the same error! I see that a file named '.idea/workspace.xml' still does contain the wrong name. Maybe delete/edit it? – Alex Nov 21 '15 at 10:31
  • @Alex: If you not renamed the directory structure, you should do that also. Go to src/main/java and check what is the folder structure there. It will be something like com/prevpath/... you should change that according to new package name – Midhun MP Nov 21 '15 at 10:32
  • I did that already before I posted this question. This should be fine... – Alex Nov 21 '15 at 10:33
  • @Alex: You don't need to specify the whole package name to activity like `com.impyiablue.stoxx.MainActivity` you only need to mention `.MainActivity` there. Reading your error I think there is still have some old package reference `com.impyiablue.stoxx/com.example.alexander.myapplication.MainActivity` – Midhun MP Nov 21 '15 at 10:44
  • 1
    I found another answer: http://stackoverflow.com/questions/8180185/package-rename-and-error-activity-class-does-not-exist and now I do not get the error anymore! However, the app does not run on the phone either!!!!!! – Alex Nov 21 '15 at 10:47
  • I also seem to see EVERY phone debug message, not just the ones by the app. Therefore, I cannot see the error!! – Alex Nov 21 '15 at 10:51
  • I probably was able to select the errors only: No error! But absolutely nothing happens on the phone!! – Alex Nov 21 '15 at 10:53

2 Answers2

0

edit application tag as show in below:

 <application
    android:allowBackup="true"
    android:icon="@mipmap/stoxx"
    android:label="@string/app_name"
    android:supportsRtl="true"
    android:theme="@style/Theme.AppCompat.Light" >
Ahmad Vatani
  • 1,630
  • 4
  • 21
  • 34
0

The activity tags are outside the application tag because you closed the application tag.

<application> " The '>' over here should not be there"
        android:allowBackup="true"
        android:icon="@mipmap/stoxx"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/Theme.AppCompat.Light" /> " The '/' over here closes the application tag."

Your activity tags need to be enclosed within the application tag.

Your application tag should like this :

    <application
        android:allowBackup="true"
        android:icon="@mipmap/stoxx"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/Theme.AppCompat.Light" >
             <activity
                android:name="com.impyiablue.stoxx.MainActivity"
                android:label="@string/app_name"
                android:theme="@style/AppTheme.NoActionBar" >
                <intent-filter>
                    <action android:name="android.intent.action.MAIN" />
                    <category android:name="android.intent.category.LAUNCHER" />
                </intent-filter>
            </activity>

            <activity
                android:name="com.impyiablue.stoxx.NewEntryActivity"
                android:label="@string/menu_add"
                android:theme="@style/AppTheme.NoActionBar"
            />
</application>
Narayan Acharya
  • 1,459
  • 1
  • 18
  • 33