我是一个纯粹的Javascript开发者(angularjs & nodejs) &对android或ios应用程序一无所知。我遵循了本土化教程,并通过以下链接创建了一个本地应用程序(Angular):用角2连接Google插件
但是在运行:tns插件添加本地文本-google sdk和运行命令tns run android之后,就会有一个异常
D:\ts\app\sample-Groceries>tns run android
Executing before-prepare hook from D:\ts\app\sample-Groceries\hooks\before-prepare\nativescript-dev-typescript.js
Found peer TypeScript 1.8.10
Project successfully prepared
WARNING: The file: D:\ts\app\sample-Groceries\node_modules\nativescript-google-maps-sdk\platforms\android\AndroidManifest.xml is depricated, you can read more about what will be the expected plugin structure here: https://www.nativescript.org/blog/migrating-n-android-plugins-from-version-1.7-to-2.0
WARNING: The file: D:\ts\app\sample-Groceries\node_modules\nativescript-google-maps-sdk\platforms\android\res\values\nativescript_google_maps_api.xml is depricated, you can read more about what will be the expected plugin structure here: https://www.nativescript.org/blog/migrating-n-android-plugins-from-version-1.7-to-2.0
:config phase: createDefaultIncludeFiles
+found plugins: nativescript-google-maps-sdk
{
"F0" {
dimension "nativescriptgooglemapssdk"
}
}
}Renaming plugin directory to flavor name: D:\ts\app\sample-Groceries\platforms\android\src\nativescript-google-maps-sdk
-> D:\ts\app\sample-Groceries\platforms\android\src\F0
+found plugins: tns-core-modules-widgets
{
"F1" {
dimension "tnscoremoduleswidgets"
}
} }Renaming plugin directory to flavor name: D:\ts\app\sample-Groceries\platforms\android\src\tns-core-modules-widgets
D:\ts\app\sample-Groceries\platforms\android\src\F1
:config phase: createPluginsConfigFile
Creating product flavors include.gradle file in D:\ts\app\sample-Groceries\platforms\android/configurations folder...
:config phase: pluginExtend
+applying configuration from: D:\ts\app\sample-Groceries\platforms\android\configurations\include.gradle
+applying configuration from: D:\ts\app\sample-Groceries\platforms\android\configurations\nativescript-google-maps-sdk\include.gradle
+applying configuration from: D:\ts\app\sample-Groceries\platforms\android\configurations\tns-core-modules-widgets\include.gradle
:config phase: copyAarDependencies
:config phase: addAarDependencies
+adding dependency: D:\ts\app\sample-Groceries\platforms\android\libs\aar\widgets-release.aar
FAILURE: Build failed with an exception.我已经访问了页面https://www.nativescript.org/blog/migrating-n-android-plugins-from-version-1.7-to-2.0,但没有得到任何信息来解决这个异常。
发布于 2016-05-16 13:01:31
可能的解决方案可能是尝试用tns platform remove android删除安卓平台,然后再用tns platform add android添加它。
关于nativescript-google-maps-sdk插件。我已经用这个插件从头开始创建了样例项目。您可以在这里查看它:NativeScript-角-GoogleMaps。最重要的是加入
NativeScript-Angular-GoogleMaps/app/App_Resources/Android/values/nativescript_google_maps_api.xml这个代码片段
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="nativescript_google_maps_api_key">API_KEY</string>
</resources>并在文件node_modules/nativescript-angular/element-registry.js的末尾添加
这条线
registerElement("mapView", function () { return require("nativescript-google-maps-sdk").MapView; });
这一行将帮助NativeScript创建MapView元素。
https://stackoverflow.com/questions/37239678
复制相似问题