dpa99c / phonegap-launch-navigator

Phonegap/Cordova plugin which launches native route navigation apps for Android, iOS and Windows
369 stars 129 forks source link

Cordova Android 7.0.0 breaking change issue? #197

Closed DomenicoImperi closed 5 years ago

DomenicoImperi commented 5 years ago

Bug report

> cordova platform add android --save
Using cordova-fetch for cordova-android@~7.0.0
Adding android project...
...
Installing "uk.co.workingedge.phonegap.plugin.launchnavigator" for android

Plugin dependency "cordova-plugin-actionsheet@2.3.3" already fetched, using that version.

Dependent plugin "cordova-plugin-actionsheet" already installed on android.

Plugin dependency "cordova-plugin-dialogs@2.0.1" already fetched, using that version.
Dependent plugin "cordova-plugin-dialogs" already installed on android.

Failed to install 'uk.co.workingedge.phonegap.plugin.launchnavigator': Error: ENOENT: no such file or directory, open 'C:\Users\Domenico\dev\IONIC\test\platforms\android\AndroidManifest.xml'
    at Object.fs.openSync (fs.js:646:18)
    at Object.fs.readFileSync (fs.js:551:33)
    at Object.parseElementtreeSync (C:\Users\Domenico\dev\IONIC\test\platforms\android\cordova\node_modules\cordova-common\src\util\xml-helpers.js:180:27)
    at new AndroidManifest (C:\Users\Domenico\dev\IONIC\test\platforms\android\cordova\lib\AndroidManifest.js:29:20)
    at AndroidProject.getPackageName (C:\Users\Domenico\dev\IONIC\test\platforms\android\cordova\lib\AndroidProject.js:99:12)
    at Api.addPlugin (C:\Users\Domenico\dev\IONIC\test\platforms\android\cordova\Api.js:223:57)
    at handleInstall (C:\Users\Domenico\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\src\plugman\install.js:594:10)
    at C:\Users\Domenico\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\src\plugman\install.js:357:28
    at _fulfilled (C:\Users\Domenico\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\node_modules\q\q.js:787:54)
    at self.promiseDispatch.done (C:\Users\Domenico\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\node_modules\q\q.js:816:30)
(node:36508) UnhandledPromiseRejectionWarning: Error: ENOENT: no such file or directory, open 'C:\Users\Domenico\dev\IONIC\test\platforms\android\AndroidManifest.xml'
    at Object.fs.openSync (fs.js:646:18)
    at Object.fs.readFileSync (fs.js:551:33)
    at Object.parseElementtreeSync (C:\Users\Domenico\dev\IONIC\test\platforms\android\cordova\node_modules\cordova-common\src\util\xml-helpers.js:180:27)
    at new AndroidManifest (C:\Users\Domenico\dev\IONIC\test\platforms\android\cordova\lib\AndroidManifest.js:29:20)
    at AndroidProject.getPackageName (C:\Users\Domenico\dev\IONIC\test\platforms\android\cordova\lib\AndroidProject.js:99:12)
    at Api.addPlugin (C:\Users\Domenico\dev\IONIC\test\platforms\android\cordova\Api.js:223:57)
    at handleInstall (C:\Users\Domenico\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\src\plugman\install.js:594:10)
    at C:\Users\Domenico\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\src\plugman\install.js:357:28
    at _fulfilled (C:\Users\Domenico\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\node_modules\q\q.js:787:54)
    at self.promiseDispatch.done (C:\Users\Domenico\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\node_modules\q\q.js:816:30)
(node:36508) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:36508) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Perhaps it is caused by the fact that they moved the AndroidManifest.xml file to the new version of the Cordova Android 7.0.0

see: https://cordova.apache.org/announcements/2017/12/04/cordova-android-7.0.0.html

dpa99c commented 5 years ago

The plugin makes a relative reference to AndroidManifest.xml which is resolved to the correct path by Cordova, so this will work with both cordova-android@6 and cordova-android@7 (see console output below).

Make sure you're using the latest Cordova CLI - v8.0.0

console output ``` $ cordova -v 8.0.0 $ cordova create test && cd test Creating a new cordova project. $ cordova plugin add uk.co.workingedge.phonegap.plugin.launchnavigator Adding uk.co.workingedge.phonegap.plugin.launchnavigator to package.json Saved plugin info for "uk.co.workingedge.phonegap.plugin.launchnavigator" to config.xml $ cordova platform add android Using cordova-fetch for cordova-android@~7.0.0 Adding android project... Creating Cordova project for the Android platform: Path: platforms\android Package: io.cordova.hellocordova Name: HelloCordova Activity: MainActivity Android target: android-26 Subproject Path: CordovaLib Subproject Path: app Android project created with cordova-android@7.0.0 Android Studio project detected Android Studio project detected Installing "uk.co.workingedge.phonegap.plugin.launchnavigator" for android Installing "cordova-plugin-actionsheet" for android Installing "cordova-plugin-dialogs" for android Subproject Path: CordovaLib Subproject Path: app Discovered plugin "cordova-plugin-whitelist" in config.xml. Adding it to the project Installing "cordova-plugin-whitelist" for android This plugin is only applicable for versions of cordova-android greater than 4.0. If you have a previous platform version, you do *not* need this plugin since the whitelist will be built in. Adding cordova-plugin-whitelist to package.json Saved plugin info for "cordova-plugin-whitelist" to config.xml --save flag or autosave detected Saving android@~7.0.0 into config.xml file ... $ source gradle4.sh $ cordova build android Android Studio project detected ANDROID_HOME=G:\Users\dpa99\AppData\Local\Android\sdk JAVA_HOME=C:\Program Files\Java\jdk1.8.0_161 studio Picked up _JAVA_OPTIONS: -Xms256m -Xmx4096m Starting a Gradle Daemon (subsequent builds will be faster) BUILD SUCCESSFUL in 4s 1 actionable task: 1 executed Subproject Path: CordovaLib Subproject Path: app Starting a Gradle Daemon, 1 incompatible Daemon could not be reused, use --status for details publishNonDefault is deprecated and has no effect anymore. All variants are now published. Observed package id 'build-tools;27.0.3' in inconsistent location 'G:\Users\dpa99\AppData\Local\Android\sdk\build-tools\current' (Expected 'G:\Users\dpa99\AppData\Local\Android\sdk\build-tools\27.0.3') Already observed package id 'build-tools;27.0.3' in 'G:\Users\dpa99\AppData\Local\Android\sdk\build-tools\27.0.3'. Skipping duplicate at 'G:\Users\dpa99\AppData\Local\Android\sdk\build-tools\current' Observed package id 'build-tools;27.0.3' in inconsistent location 'G:\Users\dpa99\AppData\Local\Android\sdk\build-tools\current' (Expected 'G:\Users\dpa99\AppData\Local\Android\sdk\build-tools\27.0.3') Already observed package id 'build-tools;27.0.3' in 'G:\Users\dpa99\AppData\Local\Android\sdk\build-tools\27.0.3'. Skipping duplicate at 'G:\Users\dpa99\AppData\Local\Android\sdk\build-tools\current' The Task.leftShift(Closure) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use Task.doLast(Action) instead. at build_3c73skfualp0fpq2g3nwd1gno.run(D:\Temp\test\platforms\android\app\build.gradle:143) (Run with --stacktrace to get the full stack trace of this deprecation warning.) Configuration 'compile' in project ':app' is deprecated. Use 'implementation' instead. :CordovaLib:preBuild UP-TO-DATE :CordovaLib:preDebugBuild UP-TO-DATE :CordovaLib:compileDebugAidl :CordovaLib:compileDebugRenderscript :CordovaLib:checkDebugManifest :CordovaLib:generateDebugBuildConfig :CordovaLib:prepareLintJar :CordovaLib:generateDebugResValues :CordovaLib:generateDebugResources :CordovaLib:packageDebugResources :CordovaLib:platformAttrExtractor :CordovaLib:processDebugManifest :CordovaLib:javaPreCompileDebug :CordovaLib:processDebugJavaRes NO-SOURCE :app:preBuild UP-TO-DATE :app:preDebugBuild Download https://jcenter.bintray.com/com/squareup/okhttp3/okhttp/maven-metadata.xml Download https://jcenter.bintray.com/com/squareup/okhttp3/okhttp/3.11.0/okhttp-3.11.0.pom Download https://jcenter.bintray.com/com/squareup/okhttp3/parent/3.11.0/parent-3.11.0.pom Download https://repo.maven.apache.org/maven2/com/squareup/okhttp3/okhttp/maven-metadata.xml :CordovaLib:processDebugResources :CordovaLib:generateDebugSources :CordovaLib:compileDebugJavaWithJavacNote: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details. :CordovaLib:transformClassesAndResourcesWithPrepareIntermediateJarsForDebug :app:compileDebugAidl :CordovaLib:packageDebugRenderscript NO-SOURCE :app:compileDebugRenderscript :app:checkDebugManifest :app:generateDebugBuildConfig :app:prepareLintJar :app:generateDebugResValues :app:generateDebugResources :app:mergeDebugResources :app:createDebugCompatibleScreenManifests :app:processDebugManifest :app:splitsDiscoveryTaskDebug :app:processDebugResources :app:generateDebugSources :app:javaPreCompileDebug Download https://jcenter.bintray.com/com/squareup/okhttp3/okhttp/3.11.0/okhttp-3.11.0.jar :app:compileDebugJavaWithJavacNote: D:\Temp\test\platforms\android\app\src\main\java\org\apache\cordova\dialogs\Notification.java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details. :app:compileDebugNdk NO-SOURCE :app:compileDebugSources :CordovaLib:mergeDebugShaders :CordovaLib:compileDebugShaders :CordovaLib:generateDebugAssets :CordovaLib:mergeDebugAssets :app:mergeDebugShaders :app:compileDebugShaders :app:generateDebugAssets :app:mergeDebugAssets :app:extractTryWithResourcesSupportJarDebug :app:transformClassesWithStackFramesFixerForDebug :app:transformClassesWithDesugarForDebug :app:transformClassesWithDexBuilderForDebug :app:transformDexArchiveWithExternalLibsDexMergerForDebug :app:transformDexArchiveWithDexMergerForDebug :CordovaLib:compileDebugNdk NO-SOURCE :CordovaLib:mergeDebugJniLibFolders :CordovaLib:transformNativeLibsWithMergeJniLibsForDebug :CordovaLib:transformNativeLibsWithStripDebugSymbolForDebug :CordovaLib:transformNativeLibsWithIntermediateJniLibsForDebug :app:mergeDebugJniLibFolders :app:transformNativeLibsWithMergeJniLibsForDebug :app:transformNativeLibsWithStripDebugSymbolForDebug :app:processDebugJavaRes NO-SOURCE :app:transformResourcesWithMergeJavaResForDebug :app:validateSigningDebug :app:packageDebug :app:assembleDebug :app:cdvBuildDebug BUILD SUCCESSFUL in 38s 49 actionable tasks: 49 executed Built the following apk(s): D:\Temp\test\platforms\android\app\build\outputs\apk\debug\app-debug.apk ```
dpa99c commented 5 years ago

Closed due to no response from OP