Nanor
Nanor

Reputation: 2550

I renamed a package and my app won't launch

I've been following this tutorial to create an android game. I downloaded the skeleton he provided but changed one of my packages from robotgame to highst. Whenever I try and deploy the application with the example code to my device I get the following error.

Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER]         cmp=com.ronyo.robotgame/com.ronyo.highst.Loader }
Error type 3
Error: Activity class {com.ronyo.robotgame/com.ronyo.highst.Loader} does not exist.

I've searched for an instance of robotgame in my project and I can't find an instance of it. The tutorial above is created using Eclipse and I'm porting it to Android Studio. I'm wondering if I've overlooked something when switching IDEs?

Here is my AndroidManifest.xml

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
   package="com.ronyo.highst"
   android:versionCode="1"
   android:versionName="1.0" >

    <uses-permission android:name="android.permission.WAKE_LOCK" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.VIBRATE" />

    <application
       android:icon="@drawable/icon"
       android:label="Loader" >
        <activity
            android:name=".Loader"
            android:configChanges="keyboard|keyboardHidden|orientation"
            android:label="Loader"
            android:screenOrientation="landscape">
            <intent-filter>
                <action android:name="android.inten.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
            </activity>
    </application>

</manifest>

Upvotes: 1

Views: 1125

Answers (4)

Percy Mugadza
Percy Mugadza

Reputation: 1

update the module build.gradle

plugins {
    id("com.android.application")
    id("org.jetbrains.kotlin.android")
    id ("kotlin-parcelize")
    id ("androidx.navigation.safeargs.kotlin")
    id ("dagger.hilt.android.plugin")
    id ("com.google.gms.google-services")
    id ("kotlin-android")
    id ("kotlin-kapt")
}

android {
    namespace = "net.mdev.shopping"
    compileSdk = 34

Upvotes: 0

hiepav
hiepav

Reputation: 588

Delete the folders .idea and .gradle then click button "Sync project with gradle files"

Upvotes: 2

Ishtiaq
Ishtiaq

Reputation: 1206

don't change it directly , It'll not update all the references, use this

right click on project > Android tools > Rename application package

enter image description here

Upvotes: 0

rharter
rharter

Reputation: 2495

It looks like the package wasn't updated everywhere. Have you changed anything in the manifest?

In the AndroidManifest.xml file, in the <manifest tag, there should be a package attribute. That needs to be updated to match your new package name, com.ronyo.highst.

Check out the documentation here: http://developer.android.com/guide/topics/manifest/manifest-element.html

Upvotes: 0

Related Questions