Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue in Adding android dependencies to NS #8939

Open
mayureshjadhav opened this issue Oct 6, 2020 · 0 comments
Open

Issue in Adding android dependencies to NS #8939

mayureshjadhav opened this issue Oct 6, 2020 · 0 comments

Comments

@mayureshjadhav
Copy link

mayureshjadhav commented Oct 6, 2020

Environment

{
  "nativescript": {
    "id": "org.nativescript.driveQuant",
    "tns-ios": {
      "version": "6.2.0"
    },
    "tns-android": {
      "version": "6.3.1"
    }
  },
  "description": "NativeScript Application",
  "license": "SEE LICENSE IN <your-license-filename>",
  "repository": "<fill-your-repository-here>",
  "dependencies": {
    "@angular/animations": "~8.2.0",
    "@angular/common": "~8.2.0",
    "@angular/compiler": "~8.2.0",
    "@angular/core": "~8.2.0",
    "@angular/forms": "~8.2.0",
    "@angular/platform-browser": "~8.2.0",
    "@angular/platform-browser-dynamic": "~8.2.0",
    "@angular/router": "~8.2.0",
    "@brycemarshall/string-format": "^1.0.2",
    "@nativescript/theme": "~2.2.0",
    "@nstudio/nativescript-checkbox": "^1.0.0",
    "nativescript-angular": "~8.20.0",
    "nativescript-background-http": "^4.2.1",
    "nativescript-fancyalert": "^3.0.9",
    "nativescript-feedback": "^1.3.12",
    "nativescript-filter-select": "^1.3.0",
    "nativescript-imagepicker": "^7.1.0",
    "nativescript-local-notifications": "^4.1.3",
    "nativescript-mediafilepicker": "^2.0.18",
    "nativescript-modal-datetimepicker": "^1.2.2",
    "nativescript-ngx-fonticon": "^5.0.2",
    "nativescript-ngx-shadow": "^6.5.0",
    "nativescript-permissions": "^1.3.8",
    "nativescript-sqlite": "^2.3.3",
    "nativescript-ui-chart": "^7.1.1",
    "nativescript-ui-gauge": "^6.0.0",
    "nativescript-ui-listview": "^8.0.1",
    "nativescript-ui-sidedrawer": "^8.0.0",
    "reflect-metadata": "~0.1.12",
    "rxjs": "^6.4.0",
    "tns-core-modules": "~6.2.0",
    "typeorm": "^0.2.22",
    "zone.js": "~0.9.1"
  },
  "devDependencies": {
    "@angular/compiler-cli": "~8.2.0",
    "@ngtools/webpack": "~8.2.0",
    "nativescript-dev-webpack": "~1.3.0",
    "tns-platform-declarations": "^6.2.3",
    "typescript": "~3.5.3"
  },
  "gitHead": "a6fec076a20f898feabb4466a2c411158c18a100",
  "readme": "NativeScript Application"
}

Describe the bug
I am trying to add driveQuant SDK (https://docs.drivequant.com/get-started-drivekit/android) into my application and when I am running the app I am getting error like

** unable to create application com.tns.nativescriptexception: calling js method oncreate cannot read property 'initialize' of undefined **

What I feel is, the SDK is not getting added.

I have included

dependencies {
  implementation 'com.drivequant.drivekit:drivekit-trip-analysis:1.6.1'
    implementation 'com.drivequant.drivekit:drivekit-core:1.6.1'
}

allprojects {
    repositories {
        maven {
            url "https://maven.drivequant.com/repository/android-sdk/"
        }
    }
}

into include.gradle file

My application.android.ts is

import { android as androidApp } from "tns-core-modules/application";

const DriveKit = com.drivequant.drivekit.core.DriveKit;
const DriveKitTripAnalysis = com.drivequant.drivekit.tripanalysis.DriveKitTripAnalysis;
const TripNotification = com.drivequant.drivekit.tripanalysis.entity.TripNotification;
const TripListener = com.drivequant.drivekit.tripanalysis.TripListener;
const DriveKitSharedPreferencesUtils = com.drivequant.drivekit.core.DriveKitSharedPreferencesUtils;
const IntentFilter = android.content.IntentFilter;

declare const com, android, global: any;
const LocalBroadcastManagerPackageName = useAndroidX() ? global.androidx.localbroadcastmanager.content : android.support.v4.content;

function useAndroidX() {
    return global.androidx && global.androidx.appcompat;
}

// the `JavaProxy` decorator specifies the package and the name for the native *.JAVA file generated.
@JavaProxy("org.myApp.Application")
class Application extends android.app.Application {
    
    public onCreate(): void {
        super.onCreate();

        //Enter custom initialization code here
        let that = this;
        DriveKit.INSTANCE.initialize(that);  // Error on this line
    }
} 

I have also added an application.android into the webpack.config

const entries = { bundle: entryPath, application: "./application.android" };

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant