You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by GitBox <gi...@apache.org> on 2020/12/02 19:13:47 UTC

[GitHub] [cordova-android] wedgberto opened a new issue #1139: MainActivity.java file deleted on build when package name is changed in config.xml

wedgberto opened a new issue #1139:
URL: https://github.com/apache/cordova-android/issues/1139


   # 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
   <!-- Include all relevant information that might help understand and reproduce the problem -->
   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
   <!-- What command or code is needed to reproduce the problem? -->
   ```
   cordova create myApp
   cd myApp
   cordova platform add android
   ```
   > this results in the file platforms/android/app/src/java/io/cordova/hellocordova/MainActivity.Java being generated
   
   `cordova run android`
   > hello cordova app builds and runs on device
   > edit config.xml -> change package name to io.cordova.goodbyecordova
   
   `cordova run android`
   > hello cordova app builds but crashes when launched on device.
   
   `cordova run android`
   >No Java files found that extend CordovaActivity.
   
   
   ### Environment, Platform, Device
   Windows 10 developer machine. 
   Android target platform.
   
   
   ### Version information
   
   Cordova Packages:
   
       cli: 10.0.0
           common: 4.0.2
           create: 3.0.0
           lib: 10.0.0
               common: 4.0.2
               fetch: 3.0.0
               serve: 4.0.0
   
   Project Installed Platforms:
   
       android: 9.0.0
   
   Project Installed Plugins:
   
       cordova-plugin-whitelist: 1.3.4
   
   Environment:
   
       OS: Microsoft Windows 10 Pro 10.0.18363 (18363) (win32 10.0.18363) x64
       Node: v10.16.3
       npm: 6.14.9
   
   android Environment:
   
       android:
   **************************************************************************
   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:
   
       config.xml:
   <?xml version='1.0' encoding='utf-8'?>
   <widget id="io.cordova.hellocordova" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
       <name>HelloCordova</name>
       <description>
           A sample Apache Cordova application that responds to the deviceready event.
       </description>
       <author email="dev@cordova.apache.org" href="http://cordova.io">
           Apache Cordova Team
       </author>
       <content src="index.html" />
       <access origin="*" />
       <allow-intent href="http://*/*" />
       <allow-intent href="https://*/*" />
       <allow-intent href="tel:*" />
       <allow-intent href="sms:*" />
       <allow-intent href="mailto:*" />
       <allow-intent href="geo:*" />
       <platform name="android">
           <allow-intent href="market:*" />
       </platform>
       <platform name="ios">
           <allow-intent href="itms:*" />
           <allow-intent href="itms-apps:*" />
       </platform>
   </widget>
   
       package.json:
   --- Start of Cordova JSON Snippet ---
   {
     "plugins": {
       "cordova-plugin-whitelist": {}
     },
     "platforms": [
       "android"
     ]
   }
   --- End of Cordova JSON Snippet ---
   
   
   
   
   ## Checklist
   <!-- Please check the boxes by putting an x in the [ ] like so: [x] -->
   
   - [x ] I searched for existing GitHub issues #1109 is complaining about the same symptoms
   - [x ] I updated all Cordova tooling to most recent version
   - [x ] I included all the necessary information above
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-android] wedgberto commented on issue #1139: MainActivity.java file deleted on build when package name is changed in config.xml

Posted by GitBox <gi...@apache.org>.
wedgberto commented on issue #1139:
URL: https://github.com/apache/cordova-android/issues/1139#issuecomment-858438734


   > 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


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-android] Fourie-r commented on issue #1139: MainActivity.java file deleted on build when package name is changed in config.xml

Posted by GitBox <gi...@apache.org>.
Fourie-r commented on issue #1139:
URL: https://github.com/apache/cordova-android/issues/1139#issuecomment-985321028


   Same issue here


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-android] Davilink commented on issue #1139: MainActivity.java file deleted on build when package name is changed in config.xml

Posted by GitBox <gi...@apache.org>.
Davilink commented on issue #1139:
URL: https://github.com/apache/cordova-android/issues/1139#issuecomment-856906185


   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.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org