Closed wedgberto closed 1 year ago
The workaround is to remove all platform and re-adding them before a cordova build. It works, but it's take longer to make build.
The workaround is to remove all platform and re-adding them before a cordova build. It works, but it's take longer to make build.
Yes, and the package name has to be changed before re-adding the android platform. I'd rather not have to do this because it takes longer to rebuild like you say
Same issue here
Sorry to dig up this issue but i'm having this problem again with cordova-android@12.0.0. If I downgrade to 11.0.0 (the release where its been fixed) it's working absolutely fine. Is there a reason why v12 reintroduced this "bug"? Hope someone can help
Sorry to dig up this issue but i'm having this problem again with cordova-android@12.0.0. If I downgrade to 11.0.0 (the release where its been fixed) it's working absolutely fine. Is there a reason why v12 reintroduced this "bug"? Hope someone can help
The changes between v11 and v12.0.1 can be found at https://github.com/apache/cordova-android/compare/rel/11.0.0...12.0.1
though nothing really stands out of why this may have regressed. If it did I'd recommend creating a new issue so we can track it appropriately.
Can confirm that this does not seem to be working. For me the destFile
and newDestFile
are equivalent (both are the old file path), so the moving/renaming code never gets triggered. I wasn't able to get cordova-android@11 working to determine if it was a regression or just never working.
Bug Report
Problem
MainActivity.java file is deleted when the package name changes
What is expected to happen?
When the package name is changed in config.xml, the MainActivity.java file is moved to the correct namespace path following the package name (E.g. io.cordova.hellocordova => io/cordova/hellocordova) This allows an app to be built with different package names so it can be installed side by side on a device.
What does actually happen?
The MainActivity.java file that exists for the previous package name gets deleted and a new one in the path for the new package name is not created.
Information
changing the package name of the app in the config.xml between builds results in the android platform folder becoming broken because the MainActivity.java file gets deleted. It is only created when the platform is added.
I commented on the commit that broke this. Package name changes were supported in 8.1.0. see https://github.com/apache/cordova-android/commit/3712619f5cd3de5055336e87bfade2bc2407900d#r43030914
Command or Code
cordova run android
cordova run android
cordova run android
Environment, Platform, Device
Windows 10 developer machine. Android target platform.
Version information
Cordova Packages:
Project Installed Platforms:
Project Installed Plugins:
Environment:
android Environment:
The "android" command is deprecated. For manual SDK, AVD, and project management, please use Android Studio. For command-line tools, use tools\bin\sdkmanager.bat and tools\bin\avdmanager.bat
Invoking "C:\dev\android-sdk\tools\bin\avdmanager" "list" "target"
Loading local repository...
[========= ] 25% Loading local repository...
[========= ] 25% Fetch remote repository...
[========= ] 25% Fetch remote repository...
[========= ] 25% Fetch remote repository...
[=======================================] 100% Fetch remote repository...
Available Android targets:
id: 1 or "android-28" Name: Android API 28 Type: Platform API level: 28 Revision: 6
id: 2 or "android-29" Name: Android API 29 Type: Platform API level: 29 Revision: 5
id: 3 or "android-30" Name: Android API 30 Type: Platform API level: 30 Revision: 3
Project Setting Files:
<?xml version='1.0' encoding='utf-8'?>
--- Start of Cordova JSON Snippet --- { "plugins": { "cordova-plugin-whitelist": {} }, "platforms": [ "android" ] } --- End of Cordova JSON Snippet ---
Checklist