Closed selected-pixel-jameson closed 6 years ago
Please double check that you are using Cordova 8.0.0 or newer.
Also update to the onesignal-cordova-plugin 2.4.1 by removing the plugin and adding it back:
ionic cordova plugin remove onesignal-cordova-plugin
ionic cordova plugin add onesignal-cordova-plugin
Please share the config.xml and crash log after checking these.
@fatsjohonimahnn hi i think it's a problem with the change on build-extras-onesignal.gradle file.
@selected-pixel-jameson The onesignal-gradle-plugin
message is only a warning as it might not be able to correctly align dependencies with other plugins. In addition to updating to Cordova CLI 8.0.0 it is recommend to update the Cordova Android Platform to 7.0.0 or newer.
cordova platform remove android
cordova platform add android@7.1.0
Please include the full runtime error if the above does not fix your issue.
I am having the same issue with Latest Ionic and OneSignal. In fact a few other projects that we have used Onesignal when recompiled with the latest OneSignal plugin are giving compilation errors.
I created an empty "tabs" Ionic project, no additional code just added latest OneSignal Plugin and can reproduce the above error.
Please somebody help fixing this error!
SUNILs-MacBook-Pro:sample princenishchal$ ionic cordova build android
Running app-scripts build: --platform android --target cordova
[16:46:38] build dev started ...
[16:46:38] clean started ...
[16:46:38] clean finished in 3 ms
[16:46:38] copy started ...
[16:46:39] deeplinks started ...
[16:46:39] deeplinks finished in 18 ms
[16:46:39] transpile started ...
[16:46:41] transpile finished in 2.18 s
[16:46:41] preprocess started ...
[16:46:41] preprocess finished in 1 ms
[16:46:41] webpack started ...
[16:46:41] copy finished in 2.29 s
[16:46:45] webpack finished in 4.22 s
[16:46:45] sass started ...
Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning.
[16:46:46] sass finished in 805 ms
[16:46:46] postprocess started ...
[16:46:46] postprocess finished in 5 ms
[16:46:46] lint started ...
[16:46:46] build dev finished in 7.31 s
> cordova build android
Android Studio project detected
ANDROID_HOME=/Users/princenishchal/Library/Android/sdk
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_151.jdk/Contents/Home
studio
Subproject Path: CordovaLib
Subproject Path: app
publishNonDefault is deprecated and has no effect anymore. All variants are now published.
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_ds6tfvzg89yqndetr6b006ner.run(/Users/princenishchal/myworkspace/mobile/testprojs/sample/platforms/android/app/build.gradle:144)
Configuration 'compile' in project ':app' is deprecated. Use 'implementation' instead.
[16:46:48] lint finished in 1.92 s
:CordovaLib:preBuild
UP-TO-DATE
:CordovaLib:preDebugBuild
UP-TO-DATE
:CordovaLib:compileDebugAidl
UP-TO-DATE
:CordovaLib:compileDebugRenderscript
UP-TO-DATE
:CordovaLib:checkDebugManifest UP-TO-DATE
:CordovaLib:generateDebugBuildConfig
UP-TO-DATE
:CordovaLib:prepareLintJar UP-TO-DATE
:CordovaLib:generateDebugResValues UP-TO-DATE
:CordovaLib:generateDebugResources UP-TO-DATE
:CordovaLib:packageDebugResources
UP-TO-DATE
:CordovaLib:platformAttrExtractor UP-TO-DATE
:CordovaLib:processDebugManifest
UP-TO-DATE
:CordovaLib:processDebugResources
UP-TO-DATE
:CordovaLib:generateDebugSources
UP-TO-DATE
:CordovaLib:javaPreCompileDebug
UP-TO-DATE
:CordovaLib:compileDebugJavaWithJavac
UP-TO-DATE
:CordovaLib:processDebugJavaRes
NO-SOURCE
:CordovaLib:transformClassesAndResourcesWithPrepareIntermediateJarsForDebug UP-TO-DATE
:app:preBuild
UP-TO-DATE
:app:preDebugBuild
FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Could not resolve all files for configuration ':app:debugCompileClasspath'.
> Could not find runtime.aar (android.arch.lifecycle:runtime:1.1.0).
Searched in the following locations:
https://jcenter.bintray.com/android/arch/lifecycle/runtime/1.1.0/runtime-1.1.0.aar
> Could not find livedata-core.aar (android.arch.lifecycle:livedata-core:1.1.0).
Searched in the following locations:
https://jcenter.bintray.com/android/arch/lifecycle/livedata-core/1.1.0/livedata-core-1.1.0.aar
> Could not find viewmodel.aar (android.arch.lifecycle:viewmodel:1.1.0).
Searched in the following locations:
https://jcenter.bintray.com/android/arch/lifecycle/viewmodel/1.1.0/viewmodel-1.1.0.aar
> Could not find runtime.aar (android.arch.core:runtime:1.1.0).
Searched in the following locations:
https://jcenter.bintray.com/android/arch/core/runtime/1.1.0/runtime-1.1.0.aar
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
* Get more help at https://help.gradle.org
BUILD FAILED in 3s
14 actionable tasks: 1 executed, 13 up-to-date
(node:27878) UnhandledPromiseRejectionWarning: Error: /Users/princenishchal/myworkspace/mobile/testprojs/sample/platforms/android/gradlew: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.
* What went wrong:
Could not resolve all files for configuration ':app:debugCompileClasspath'.
> Could not find runtime.aar (android.arch.lifecycle:runtime:1.1.0).
Searched in the following locations:
https://jcenter.bintray.com/android/arch/lifecycle/runtime/1.1.0/runtime-1.1.0.aar
> Could not find livedata-core.aar (android.arch.lifecycle:livedata-core:1.1.0).
Searched in the following locations:
https://jcenter.bintray.com/android/arch/lifecycle/livedata-core/1.1.0/livedata-core-1.1.0.aar
> Could not find viewmodel.aar (android.arch.lifecycle:viewmodel:1.1.0).
Searched in the following locations:
https://jcenter.bintray.com/android/arch/lifecycle/viewmodel/1.1.0/viewmodel-1.1.0.aar
> Could not find runtime.aar (android.arch.core:runtime:1.1.0).
Searched in the following locations:
https://jcenter.bintray.com/android/arch/core/runtime/1.1.0/runtime-1.1.0.aar
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
* Get more help at https://help.gradle.org
BUILD FAILED in 3s
at ChildProcess.whenDone (/Users/princenishchal/myworkspace/mobile/testprojs/sample/platforms/android/cordova/node_modules/cordova-common/src/superspawn.js:169:23)
at emitTwo (events.js:126:13)
at ChildProcess.emit (events.js:214:7)
at maybeClose (internal/child_process.js:925:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
(node:27878) 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:27878) [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.
The project will compile if I remove the onesignal plugin
The installed plugins are
> cordova plugin ls
cordova-plugin-device 2.0.2 "Device"
cordova-plugin-ionic-keyboard 2.0.5 "cordova-plugin-ionic-keyboard"
cordova-plugin-ionic-webview 1.1.19 "cordova-plugin-ionic-webview"
cordova-plugin-splashscreen 5.0.2 "Splashscreen"
cordova-plugin-whitelist 1.3.3 "Whitelist"
onesignal-cordova-plugin 2.4.1 "OneSignal Push Notifications"
Ionic Info
cli packages: (/usr/local/lib/node_modules)
@ionic/cli-utils : 1.19.2
ionic (Ionic CLI) : 3.20.0
global packages:
cordova (Cordova CLI) : 8.0.0
local packages:
@ionic/app-scripts : 3.1.10
Cordova Platforms : android 7.0.0
Ionic Framework : ionic-angular 3.9.2
System:
Android SDK Tools : 26.1.1
ios-deploy : 1.9.2
Node : v8.11.3
npm : 5.6.0
OS : macOS High Sierra
Xcode : Xcode 9.4.1 Build version 9F2000
Environment Variables:
ANDROID_HOME : /Users/princenishchal/Library/Android/sdk
Misc:
backend : pro
Hey, I found one way that worked. It is same as what @atorgfr has suggested.
Steps:
ionic cordova add plugin onesignal-cordova-plugin@2.3.0
platforms/android/onesignal-cordova-plugin
to a temporary locationplatforms/android/onesignal-cordova-plugin
pheww... lots of steps. After so many permutations and combinations this seemed to work. Special thanks and mentions to @atorgfr .
@princenishchal
There's a simpler way, and no need to downgrade: https://github.com/OneSignal/OneSignal-Cordova-SDK/issues/385
When will it be resolved? Thanks
Description: When I try to run
ionic cordova run android --device
in Ionic app with the latest OneSignal SDK I get the following error and the app fails to launch. When I downgraded to 2.4.0 it works fine.'Please put onesignal-gradle-plugin first OR update to com.android.tools.build:gradle:3.0.0 or newer!
Environment
Steps to Reproduce Issue: