roblav96 / nativescript-onesignal

A Nativescript plugin that wraps the iOS and Android OneSignal Push Notifications SDK.
https://documentation.onesignal.com/docs/getting-started
Other
24 stars 42 forks source link

Remove @aar from Android dependency #36

Closed jkasten2 closed 6 years ago

jkasten2 commented 6 years ago
jkasten2 commented 6 years ago

The following could also be added to the top to fix version conflicts with Google Play services and the Android Support library with other plugins.

buildscript {
    repositories {
        maven { url 'https://plugins.gradle.org/m2/' } // Gradle Plugin Portal 
    }
    dependencies {
        // OneSignal-Gradle-Plugin
        classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.10.1, 0.99.99]'
    }
}

I haven't used NativeScript specifically before so don't know how the platforms/android/include.gradle will be inserted into the gradle project.

If anyone can test and confirm this works I can add this to the PR as well.

jkasten2 commented 6 years ago

This PR is similar to #16 but does so in a more automatic way

Ericky14 commented 6 years ago

@jkasten2 This did not fix the issue. I made the change in the PR and also added the buildscript, I still get the Outdated Android Support Library message.

Ericky14 commented 6 years ago

37 solved my problem @jkasten2

Thanks

jkasten2 commented 6 years ago

@Ericky14 Just added OneSignal-Gradle-Plugin to this repo tested it with nativescript 4.1.0 and tns-android 4.1.1 without any issues. My tns info on my project I tested with.

✔ Getting NativeScript components versions information...
✔ Component nativescript has 4.1.0 version and is up to date.
⚠ Update available for component tns-core-modules. Your current version is 4.0.1 and the latest available version is 4.1.0.
✔ Component tns-android has 4.1.1 version and is up to date.
Ericky14 commented 6 years ago

@jkasten2 I installed the latest versions and made the same changes as in this PR to include.gradle in the node_modules nativescript-onesignal and I got the following error when running tns run android.

/Users/ericky/Development/inkapp/platforms/android/app/src/debug/java/com/tns/ErrorReportActivity.java:13: error: cannot access ActivityCompatApi23
public class ErrorReportActivity extends AppCompatActivity {
       ^
  class file for android.support.v4.app.ActivityCompatApi23 not found
/Users/ericky/Development/inkapp/platforms/android/app/src/debug/java/com/tns/ErrorReportActivity.java:15: error: cannot find symbol
        setTheme(android.support.v7.appcompat.R.style.Theme_AppCompat_NoActionBar);
        ^
  symbol:   method setTheme(int)
  location: class ErrorReportActivity
/Users/ericky/Development/inkapp/platforms/android/app/src/debug/java/com/tns/ErrorReportActivity.java:17: error: cannot find symbol
        super.onCreate(savedInstanceState);
        ^
  symbol:   variable super
  location: class ErrorReportActivity
/Users/ericky/Development/inkapp/platforms/android/app/src/debug/java/com/tns/ErrorReportActivity.java:19: error: cannot find symbol
        new ErrorReport(this).buildUI();
                        ^
  symbol:   variable this
  location: class ErrorReportActivity
/Users/ericky/Development/inkapp/platforms/android/app/src/debug/java/com/tns/ErrorReportActivity.java:22: error: method does not override or implement a method from a supertype
    @Override
    ^
/Users/ericky/Development/inkapp/platforms/android/app/src/debug/java/com/tns/ErrorReportActivity.java:24: error: cannot find symbol
        super.onUserLeaveHint();
        ^
  symbol:   variable super
  location: class ErrorReportActivity
/Users/ericky/Development/inkapp/platforms/android/app/src/debug/java/com/tns/ErrorReportActivity.java:27: error: cannot find symbol
            ErrorReport.killProcess(this);
                                    ^
  symbol:   variable this
  location: class ErrorReportActivity
/Users/ericky/Development/inkapp/platforms/android/app/src/debug/java/com/tns/ErrorReportActivity.java:40: error: cannot find symbol
            Toast.makeText(this, "Couldn't resolve permissions", Toast.LENGTH_LONG).show();
                           ^
  symbol:   variable this
  location: class ErrorReportActivity
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: /Users/ericky/Development/inkapp/platforms/android/app/src/main/java/technology/master/nativescript/WebSocket.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
8 errors

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
Ericky14 commented 6 years ago

@jkasten2 Just to note, I was able to run the project fine before adding the Onesignal Gradle Plugin stuff to the include.gradle. And I am using nativescript-angular, not just pure nativescript.