我有一个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的大小比调试版本(46 of )小(38 Of)。我认为这可能与缩小/缩小等有关,这导致了问题的出现。所以我把这个加到我的梯度上:
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"
}发布于 2019-01-15 20:54:29
经过几个小时的反复试验,我找到了它。是那个包裹
"nativescript-hook-debug-production": "1.0.4" 这就引起了这个问题。
移除它后,它起作用了。
https://stackoverflow.com/questions/54202311
复制相似问题