nativescript-cfalert-dialog icon indicating copy to clipboard operation
nativescript-cfalert-dialog copied to clipboard

Android: Error in nativescript-cfalert-dialog include.js when running nativescript android app

Open rickystern opened this issue 2 years ago • 2 comments

Which platform(s) does your issue occur on?

  • Android
  • Android : 8.4.0
  • emulator

Please, provide the following version numbers that your issue occurs with:

  • CLI: 8.4.0

Please, tell us how to recreate the issue in as much detail as possible.

trying to run nativescript android project produces the following error:

Script 'appFolder/node_modules/nativescript-cfalert-dialog/platforms/android/include.gradle' line: 17
A problem occurred evaluating script.
Could not find method compile() for arguments [com.android.support:appcompat-v7:22.2.0] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

Command ./gradlew failed with exit code 1

Can anyone assist in fixing this issue

rickystern avatar Mar 08 '23 17:03 rickystern

Hi! 👋

Today I used patch-package to patch [email protected] for the project I'm working on.

Changed to work on ns8.4 on Android

Here is the diff that solved my problem:

diff --git a/node_modules/nativescript-cfalert-dialog/cfalert-dialog.android.js b/node_modules/nativescript-cfalert-dialog/cfalert-dialog.android.js
index d78177a..c977c12 100644
--- a/node_modules/nativescript-cfalert-dialog/cfalert-dialog.android.js
+++ b/node_modules/nativescript-cfalert-dialog/cfalert-dialog.android.js
@@ -1,6 +1,6 @@
 "use strict";
 Object.defineProperty(exports, "__esModule", { value: true });
-var app = require("@nativescript/application");
+var app = require("@nativescript/core/application");
 var color_1 = require("@nativescript/core");
 var CFAlertStyle;
 (function (CFAlertStyle) {
diff --git a/node_modules/nativescript-cfalert-dialog/platforms/android/include.gradle b/node_modules/nativescript-cfalert-dialog/platforms/android/include.gradle
index 7452280..ec7777e 100644
--- a/node_modules/nativescript-cfalert-dialog/platforms/android/include.gradle
+++ b/node_modules/nativescript-cfalert-dialog/platforms/android/include.gradle
@@ -14,7 +14,7 @@ dependencies {
   if(project.hasProperty("supportVersion")) {
   	supportVer = supportVersion
   }
-  compile "com.android.support:appcompat-v7:$supportVer"
-  compile "com.android.support:cardview-v7:$supportVer"
+  implementation "com.android.support:appcompat-v7:$supportVer"
+  implementation "com.android.support:cardview-v7:$supportVer"
   implementation group: 'com.crowdfire.cfalertdialog', name: 'cfalertdialog', version: '1.1.0'
 }

cristiandaulisio avatar Mar 15 '23 21:03 cristiandaulisio

@cristiandaulisio Nice work! can you please PR that change, I can merge it and roll out a new version. Just @ mention me so that I get an email about it. Thanks :)

shiv19 avatar Mar 21 '23 03:03 shiv19