'Build Android App with Old Manifest Package Name

When I build an Android app, there's an error message shown like this

Package 'grwe.android.package' from AndroidManifest.xml is not a valid Java package name as 'package' is a Java keyword

but, I've already had an app that was published on Google Play Store before with that manifest package name,

So, what should I do right now?

I built android app using EAS (Expo & React Native)



Solution 1:[1]

Your applicationId does not necessarly need to match the source code.

Keep your applicationId as the published one in your gradle build file.

// build.gradle.kts

defaultConfig {
    applicationId = "grwe.android.package"
        ...
}

Organize your kotlin/java source code in package like grwe.android.packer or grwe.android.packager

package com.example.codes

class SomeActivity : AppCompatActivity() {
    ...
}

Android System will launch your activity like

androidApplicationId/fullQualifiedClassNameForActivity

grwe.android.package/com.example.codes.SomeActivity

grwe.android.package/net.example.OtherActivity

Hope, it helps.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 ocos