Open jkasten2 opened 6 years ago
There are missing files when you add the plugin from github can you add npm repo to the new branch ?
@OPADA-Eng @jkasten2 Same problem here, tried to follow this steps and I was able to avoid the gradle issue but still cannot do the "require". Any fix ?
@MopheusDG just remove the file from hooks/after-prepare/nativescript-onesignal-gradle.js and remove platform "android" then rebuild your project
Thank you @OPADA-Eng, I've done that before but for some reason was still failing on my APP, so I created a new one and it's working now, so need to re-implement in mine.
By the way, I've created a request for help to change the main.ts code required to JS as I was able to modify the Android code but the IOS code is more difficult, to see if someone can help me. #43.
Android modified code works but I don't have the skill to modify the IOS one, it's much more complicated.
Thanks !
@OPADA-Eng @MopheusDG hmm ya weird, using tns plugin add
on a repo vs an npm module is causing require
to no longer find OneSignal at runtime. I might be doing something different when importing from a URL then.
@roblav96 I believe after we merge this PR and create a release this should fix issues #38 and #39. Can you merge it in and push a new release to NPM?
Would love to have this merged and released to NPM. Been struggling to get this issue to work for many hours without success. Pity, when the plugin seems so nice otherwise.
Ping @roblav96 ;)
If I use tns plugin add
on the Onesignal/nativescript-onesignal
repo - it somehow fails to install actual .ts files (see attached image) - that's why it can't be found at runtime - there is nothing to be found
I am struggling to make this lib working on tns v6.5.0 for android @roblav96 it would be nice to merge this pull request anyway
Ok, I resolved empty require
with just using another way to add plugin from repo
tns plugin add https://github.com/OneSignal/nativescript-onesignal/archive/master.tar.gz
but then I got such error:
A problem occurred configuring project ':app'.
All flavors must now belong to a named flavor dimension. Learn more at https://d.android.com/r/tools/flavorDimensions-missing-error-message.html
Command ./gradlew failed with exit code 1
It is resolved by removing or commenting this section from platforms/android/include.gradle
:
...
productFlavors {
'nativescriptonesignal' {
dimension 'nativescriptonesignal'
}
}
...
@jkasten2 it would be great if you make a new commit with this fix P.S. I am not into android development at all, so if it breaks something else and there is more convenient fix - you're welcome
UPDATE:
As a quick workaround you may add this to your app.gradle
:
android {
...
flavorDimensions "nativescriptonesignal"
...
}
hey @Onefivefournine, do you want to setup a fork of this project with me and make it work properly?
Build Error
This fixes the following
tns build android
error.Issue Details
Hooks added in 1.0.8 by PR #37 are creating Android build errors due to
maven { url "https://plugins.gradle.org/m2/" }
being added to incorrect locations inbuild.gradle
files. This will resolve issues #38 and #39.Solution
Removing these install hooks modify the
build.gradle
files. They are not needed as the OneSignal-Gradle-Plugin added in PR #36 takes care of fixing Android dependency versions it was trying to fix.Upgrading from 1.0.8
tns plugin remove nativescript-onesignal
rm hooks/after-prepare/nativescript-onesignal-gradle.js
tns build android
maven { url "https://plugins.gradle.org/m2/" }
remove the lines from thebuild.gradle
files it notes.tns platform clean android
platforms/android
folder.tns plugin add https://github.com/OneSignal/nativescript-onesignal
tns platform clean android
you will need to add back the OneSignalmanifestPlaceholders
toplatforms/android/app/build.gradle
.tns build android