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/07/20 23:12:30 UTC

[GitHub] [cordova-common] breautek opened a new issue #151: Unable to graft xml at selector "manifest/uses-sdk"

breautek opened a new issue #151:
URL: https://github.com/apache/cordova-common/issues/151


   # Bug Report
   
   ## Problem
   
   ### What is expected to happen?
   
   `<edit-config>` to apply changes to `AndroidManifest.xml`
   
   ### What does actually happen?
   
   An error occurs and the build fails.
   
   ## Information
   <!-- Include all relevant information that might help understand and reproduce the problem -->
   
   Error stacktrace:
   
   ```
   Unable to graft xml at selector "/manifest/uses-sdk" from "C:\Users\norman\development\gradletest\platforms\android\app\src\main\AndroidManifest.xml" during config install
   Error: Unable to graft xml at selector "/manifest/uses-sdk" from "C:\Users\norman\development\gradletest\platforms\android\app\src\main\AndroidManifest.xml" during config install
       at ConfigFile_graft_child [as graft_child] (C:\Users\norman\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-common\src\ConfigChanges\ConfigFile.js:120:19)
       at PlatformMunger_apply_file_munge [as apply_file_munge] (C:\Users\norman\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-common\src\ConfigChanges\ConfigChanges.js:81:34)
       at munge_helper (C:\Users\norman\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-common\src\ConfigChanges\ConfigChanges.js:238:14)
       at PlatformMunger.add_config_changes (C:\Users\norman\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-common\src\ConfigChanges\ConfigChanges.js:216:12)
       at C:\Users\norman\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\src\cordova\prepare.js:112:32
       at async Promise.all (index 0)
   ```
   
   
   ### Command or Code
   <!-- What command or code is needed to reproduce the problem? -->
   
   Use `cordova create` to build a simple hello world project.
   
   Inside the `config.xml` add:
   
   ```xml
   <edit-config file="AndroidManifest.xml" mode="overwrite" target="/manifest/uses-sdk">
       <uses-sdk android:minSdkVersion="16" android:maxSdkVersion="23" />
   </edit-config>
   ```
   
   This is a copied and paste example from the [docs](https://cordova.apache.org/docs/en/latest/plugin_ref/spec.html#edit-config). But this appears to occur when having `target="/manifest/uses-sdk"`, regardless of the body of `<edit-config>` block.
   
   Do note that the following does **not** fail:
   
   ```xml
   <edit-config file="AndroidManifest.xml" mode="merge" target="/manifest">
       <manifest xmlns:tools="http://schemas.android.com/tools" />
   </edit-config>
   ```
   
   This leads me to believe perhaps this occurs if the `AndroidManifest.xml` does not have the target node.
   
   Finally run: `cordova build android` to observe the failure.
   
   
   ### Environment, Platform, Device
   <!-- In what environment, on what platform or on which device are you experiencing the issue? -->
   
   Windows 10
   Cordova-Android 9
   
   ### Version information
   <!--
   What are relevant versions you are using?
   For example:
   Cordova: Cordova CLI, Cordova Platforms, Cordova Plugins
   Other Frameworks: Ionic Framework and CLI version
   Operating System, Android Studio, Xcode etc.
   -->
   
   Windows 10
   cordova: 9.0.0 (cordova-lib@9.0.1)
   
   ## Checklist
   <!-- Please check the boxes by putting an x in the [ ] like so: [x] -->
   
   - [ ] I searched for existing GitHub issues
   - [ ] I updated all Cordova tooling to most recent version
   - [ ] 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-common] bhandaribhumin edited a comment on issue #151: Unable to graft xml at selector "manifest/uses-sdk"

Posted by GitBox <gi...@apache.org>.
bhandaribhumin edited a comment on issue #151:
URL: https://github.com/apache/cordova-common/issues/151#issuecomment-1007304495


   @breautek  facing similar issue 
   `Unable to graft xml at selector "/manifest/application/activity[@android:theme='@style/Theme.AppCompat.NoActionBar']" from "/Users/bhuminbhandari/Desktop/projects/app/platforms/android/app/src/main/AndroidManifest.xml" during config install`
   
   First time works but second time when we run `cordova build android` it will show above error.
   
   Script 
    ```
    <edit-config  mode="merge"  file="app/src/main/AndroidManifest.xml" target="/manifest/application/activity[@android:theme='@style/Theme.AppCompat.NoActionBar']" >
               <activity android:theme="@style/RemoveSystemSplashScreen"></activity>
           </edit-config>
   ```


-- 
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-common] erisu commented on issue #151: Unable to graft xml at selector "manifest/uses-sdk"

Posted by GitBox <gi...@apache.org>.
erisu commented on issue #151:
URL: https://github.com/apache/cordova-common/issues/151#issuecomment-661664336


   I believe we should remove this from documentation.
   
   We don't set the `uses-sdk` setting anymore and try to keep everything inside the Gradle.
   
   If you try and set the minSDK, like the example you wrote above, Android Studio will complain:
   
   > The minSdk version should not be declared in the android manifest file. You can move the version from the manifest to the defaultConfig in the build.gradle file.
   > Move minSdkVersion to build file and sync project
   > Affected Modules: app
   
   I think the other settings does not get these sync warnings but managing the settings in Gradle and in the Manifest was maybe a bit excessive maybe? So I believe it was decided to do only Gradle.


----------------------------------------------------------------
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-common] bhandaribhumin commented on issue #151: Unable to graft xml at selector "manifest/uses-sdk"

Posted by GitBox <gi...@apache.org>.
bhandaribhumin commented on issue #151:
URL: https://github.com/apache/cordova-common/issues/151#issuecomment-1007304495


   @breautek  facing similar issue 
   `Unable to graft xml at selector "/manifest/application/activity[@android:theme='@style/Theme.AppCompat.NoActionBar']" from "/Users/bhuminbhandari/Desktop/projects/app/platforms/android/app/src/main/AndroidManifest.xml" during config install`
   
   First time works but second time when we run `cordova build android` it will show above error.
   
    ```
    <edit-config  mode="overwrite"  file="app/src/main/AndroidManifest.xml" target="/manifest/application/activity[@android:theme='@style/Theme.AppCompat.NoActionBar']" >
               <activity android:theme="@style/RemoveSystemSplashScreen"></activity>
           </edit-config>
   ```


-- 
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-common] bhandaribhumin edited a comment on issue #151: Unable to graft xml at selector "manifest/uses-sdk"

Posted by GitBox <gi...@apache.org>.
bhandaribhumin edited a comment on issue #151:
URL: https://github.com/apache/cordova-common/issues/151#issuecomment-1007304495


   @breautek  facing similar issue 
   `Unable to graft xml at selector "/manifest/application/activity[@android:theme='@style/Theme.AppCompat.NoActionBar']" from "/Users/bhuminbhandari/Desktop/projects/app/platforms/android/app/src/main/AndroidManifest.xml" during config install`
   
   First time works but second time when we run `cordova build android` it will show above error.
   
   Script 
    ```
    <edit-config  mode="merge or try overwrite"   file="app/src/main/AndroidManifest.xml" target="/manifest/application/activity[@android:theme='@style/Theme.AppCompat.NoActionBar']" >
               <activity android:theme="@style/RemoveSystemSplashScreen"></activity>
           </edit-config>
   ```


-- 
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-common] breautek commented on issue #151: Unable to graft xml at selector "manifest/uses-sdk"

Posted by GitBox <gi...@apache.org>.
breautek commented on issue #151:
URL: https://github.com/apache/cordova-common/issues/151#issuecomment-661827357


   Yah, the documentation could have been removed.
   
   But `<uses-sdk>` tag itself isn't deprecated and there is still some potential use cases for it. Such as overriding libraries via [tools:overrideLibrary](https://developer.android.com/studio/build/manifest-merge#override_uses-sdk_for_imported_libraries) attribute. Which may be necessary depending libraries being imported into the android project.


----------------------------------------------------------------
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-common] bhandaribhumin edited a comment on issue #151: Unable to graft xml at selector "manifest/uses-sdk"

Posted by GitBox <gi...@apache.org>.
bhandaribhumin edited a comment on issue #151:
URL: https://github.com/apache/cordova-common/issues/151#issuecomment-1007304495






-- 
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-common] bhandaribhumin edited a comment on issue #151: Unable to graft xml at selector "manifest/uses-sdk"

Posted by GitBox <gi...@apache.org>.
bhandaribhumin edited a comment on issue #151:
URL: https://github.com/apache/cordova-common/issues/151#issuecomment-1007304495


   @breautek  facing similar issue 
   `Unable to graft xml at selector "/manifest/application/activity[@android:theme='@style/Theme.AppCompat.NoActionBar']" from "/Users/bhuminbhandari/Desktop/projects/app/platforms/android/app/src/main/AndroidManifest.xml" during config install`
   
   First time works but second time when we run `cordova build android` it will show above error.
   
   Script 
    ```
    <edit-config  mode="overwrite"  file="app/src/main/AndroidManifest.xml" target="/manifest/application/activity[@android:theme='@style/Theme.AppCompat.NoActionBar']" >
               <activity android:theme="@style/RemoveSystemSplashScreen"></activity>
           </edit-config>
   ```


-- 
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-common] bhandaribhumin commented on issue #151: Unable to graft xml at selector "manifest/uses-sdk"

Posted by GitBox <gi...@apache.org>.
bhandaribhumin commented on issue #151:
URL: https://github.com/apache/cordova-common/issues/151#issuecomment-1007304495


   @breautek  facing similar issue 
   `Unable to graft xml at selector "/manifest/application/activity[@android:theme='@style/Theme.AppCompat.NoActionBar']" from "/Users/bhuminbhandari/Desktop/projects/app/platforms/android/app/src/main/AndroidManifest.xml" during config install`
   
   First time works but second time when we run `cordova build android` it will show above error.
   
    ```
    <edit-config  mode="overwrite"  file="app/src/main/AndroidManifest.xml" target="/manifest/application/activity[@android:theme='@style/Theme.AppCompat.NoActionBar']" >
               <activity android:theme="@style/RemoveSystemSplashScreen"></activity>
           </edit-config>
   ```


-- 
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