执行静态绑定生成器:
错误:文件已经存在。这可能导致不想要的行为。请更改其中一个扩展类的名称。File:C:\repo\geo\geoapp\platforms\android\app\src\main\java\com\tns\FragmentClass.java类: com.tns.FragmentClass
我一直在犯这个错误。它从尝试让@nativescript/geolocation插件开始工作开始。它编译了,但是当调用geolocation.watchLocation()方法时,应用程序会崩溃。这就是我想要修复的。我运行了几次ns clean,重新启动,并删除了c:\users\<username>\.gradle文件夹。删除.gradle文件夹时,我之前有此错误。
这可能与使用nativescript-google-maps-sdk插件有关。我相信googlePlayServicesVersion有一个众所周知的问题。在没有joy的情况下,我也尝试了这些选择。我有点困惑,我应该编辑哪个文件;有些提到/app/App_Resources/Android/app.gradle,另一些提到app/App_Resources/Android/before-plugins.gradle,我尝试了两者。
如有任何建议,将不胜感激。
"dependencies": {
"@nativescript/core": "~8.1.1",
"@nativescript/theme": "~3.0.1",
"nativescript-vue": "~2.9.0",
"vuex": "~3.6.2",
"@nativescript/geolocation": "7.0.0",
"@nativescript/directions": "~2.0.1",
"@nativescript/social-share": "~2.0.4",
"@triniwiz/nativescript-couchbase": "~1.2.5",
"@triniwiz/nativescript-toasty": "~4.1.3",
"@bradmartin/nativescript-urlhandler": "~2.0.1",
"nativescript-google-maps-sdk" : "3.0.2",
"nativescript-gif": "~5.0.0"
},
"devDependencies": {
"@nativescript/android": "8.1.1",
"@nativescript/webpack": "~5.0.0",
"nativescript-vue-template-compiler": "~2.9.0",
"@vue/devtools": "^5.3.4",
"@triniwiz/nativescript-toasty": "~4.1.3",
"@triniwiz/nativescript-socketio": "4.0.1",
"nativescript-vue-devtools": "1.5.1"
}发布于 2021-10-31 15:34:48
修好了!为了缩小底层问题的范围,我创建了一个新项目,在中间逐点运行ns build android命令复制原始代码。原来是一些旧的包引用(import Something from 'some-packages'),从我切换旧的tns-包到新的@nativescript包。然而,这一套方案在开始工作之前需要进一步使用--强制选项(ns build android --force)。
根据@nativescript/geolocation nativescript-google-maps sdk部件,这是通过添加一个App_Resources\Android\pred-plugins.gradle文件来修复的,其内容如下
android {
project.ext {
googlePlayServicesVersion = "16.+"
}
dependencies {
def googlePlayServicesVersion = project.googlePlayServicesVersion
compile "com.google.android.gms:play-services-location:$googlePlayServicesVersion"
}
}https://stackoverflow.com/questions/69759598
复制相似问题