仅在发行版中的Android上的Nativescript java.lang.UnsatisfiedLinkError

时间:2019-01-15 15:50:08

标签: android angular nativescript

我有一个NativeScript应用程序,如果我在调试模式下构建它,它将运行良好。 在发布模式下的同一设备上,该应用程序在启动时崩溃并在日志中显示以下内容:

01-15 16:23:01.474 12229 12229 E script.demo: No implementation found for void com.tns.AndroidJsV8Inspector.init() (tried Java_com_tns_AndroidJsV8Inspector_init and Java_com_tns_AndroidJsV8Inspector_init__)
01-15 16:23:01.474 12229 12229 D AndroidRuntime: Shutting down VM
01-15 16:23:01.475 12229 12229 E AndroidRuntime: FATAL EXCEPTION: main
01-15 16:23:01.475 12229 12229 E AndroidRuntime: Process: org.nativescript.demo, PID: 12229
01-15 16:23:01.475 12229 12229 E AndroidRuntime: java.lang.UnsatisfiedLinkError: No implementation found for void com.tns.AndroidJsV8Inspector.init() (tried Java_com_tns_AndroidJsV8Inspector_init and Java_com_tns_AndroidJsV8Inspector_init__)

发行版APK的大小也比调试版本(46MB)小(38MB)。我认为这可能与缩小/缩小等有关,这会导致问题。 所以我将此添加到了我的gradle中:

android {  
 lintOptions {
  checkReleaseBuilds false
}
defaultConfig {  
  applicationId "org.nativescript.demo"
  multiDexEnabled true
  generatedDensities = []
}  
aaptOptions {  
  additionalParameters "--no-version-vectors"  
}  
 buildTypes {
   release {
      minifyEnabled false //keeps unused methods instead of removing them
      shrinkResources false
  }
}

这也无济于事... 我没主意了

感谢任何提示

更新 package.json:

    {
  "nativescript": {
    "id": "org.nativescript.demo",
    "tns-ios": {
      "version": "5.1.0"
    },
    "tns-android": {
      "version": "5.1.0"
    }
  },
  "description": "NativeScript Application",
  "license": "SEE LICENSE IN <your-license-filename>",
  "repository": "<fill-your-repository-here>",
  "scripts": {
    "lint": "tslint \"src/**/*.ts\""
  },
  "dependencies": {
    "@angular/animations": "~7.1.4",
    "@angular/common": "~7.1.4",
    "@angular/compiler": "~7.1.4",
    "@angular/core": "~7.1.4",
    "@angular/forms": "~7.1.4",
    "@angular/http": "~7.1.4",
    "@angular/platform-browser": "~7.1.4",
    "@angular/platform-browser-dynamic": "~7.1.4",
    "@angular/router": "~7.1.4",
    "@types/text-encoding": "0.0.35",
    "nativescript-angular": "~7.1.0",
    "nativescript-bluetooth": "1.3.1",
    "nativescript-feedback": "1.3.3",
    "nativescript-floatingactionbutton": "5.0.0",
    "nativescript-hook-debug-production": "1.0.4",
    "nativescript-localize": "4.1.0",
    "nativescript-modal-datetimepicker": "1.1.12",
    "nativescript-plugin-firebase": "7.6.0",
    "nativescript-theme-core": "~1.0.4",
    "nativescript-ui-chart": "3.11.1",
    "nativescript-ui-dataform": "3.10.0",
    "nativescript-ui-sidedrawer": "~5.1.0",
    "reflect-metadata": "~0.1.10",
    "rxjs": "~6.3.0",
    "text-encoding": "0.7.0",
    "tns-core-modules": "~5.1.1",
    "zone.js": "~0.8.18"
  },
  "devDependencies": {
    "@nativescript/schematics": "~0.4.0",
    "codelyzer": "~4.5.0",
    "nativescript-dev-sass": "~1.6.0",
    "nativescript-dev-typescript": "~0.7.0",
    "nativescript-dev-webpack": "~0.19.0",
    "tslint": "~5.12.0",
    "typescript": "3.2.2",
    "@angular/compiler-cli": "~7.1.4",
    "@ngtools/webpack": "~7.1.4"
  },
  "readme": "NativeScript Application",
  "author": "Demo"
}

1 个答案:

答案 0 :(得分:0)

经过数小时的反复试验,我发现了它。 它是包

"nativescript-hook-debug-production": "1.0.4" 

导致问题的原因。

删除后,它可以正常工作。