gpt4 book ai didi

javascript - NativeScript nativescript-google-maps-sdk 不工作

转载 作者:行者123 更新时间:2023-11-29 19:13:16 25 4
gpt4 key购买 nike

我是纯 Javascript 开发人员(angularjs 和 nodejs),对 android 或 ios 应用一无所知。我遵循了 nativescipt 的教程并在以下链接的帮助下在 nativescipt(angular) 中创建了一个应用程序: Wiring up Google Maps Nativescript plugin with Angular 2
但在运行之后:tns plugin add nativescript-google-maps-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但没有获得任何信息来解决此异常。

最佳答案

可能的解决方案是尝试使用 tns platform remove android 删除 android 平台,然后使用 tns platform add android 再次添加它。

关于 nativescript-google-maps-sdk 插件。我使用这个插件从头开始创建示例项目。您可以在这里查看:NativeScript-Angular-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 元素。

关于javascript - NativeScript nativescript-google-maps-sdk 不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37239678/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com