代号为一个未显示的原生地图

时间:2018-01-21 17:08:05

标签: codenameone

我正在使用原生地图CN1Lib作为我的项目。我按照here的说明进行操作,并添加了所需的构建提示。在模拟器中,地图看起来很好但是当我将它导出到android(android studio上的调试)时,地图只显示为左下角带有“Google”的灰色矩形。

我认为这是google api的一个问题所以我在google console上创建了一些新的api密钥。所有按键都不受限制。谷歌地图Android API也已启用,但问题仍然存在。我还检查了在导出的apk中的AndroidManifest.xml中包含了正确的api。

以下是构建提示(api密钥审查的一部分):

codename1.android.keystore=
codename1.android.keystoreAlias=
codename1.android.keystorePassword=
codename1.arg.android.playService.maps=true
codename1.arg.android.xapplication=<meta-data android\:name\="com.google.android.maps.v2.API_KEY" android\:value\="AIza__________________________________"/>
codename1.arg.build.incSources=1
codename1.arg.ios.add_libs=SystemConfiguration.framework
codename1.arg.ios.afterFinishLaunching=[GMSServices provideAPIKey\:@"AIza__________________________________"];
codename1.arg.ios.locationUsageDescription=To provide near-by stores info to the user
codename1.arg.ios.newStorageLocation=true
codename1.arg.ios.objC=true
codename1.arg.java.version=8
codename1.arg.javascript.googlemaps.key=AIza__________________________________
codename1.displayName=Medi
codename1.icon=icon.png
codename1.ios.certificate=
codename1.ios.certificatePassword=
codename1.ios.provision=
codename1.j2me.nativeTheme=nativej2me.res
codename1.languageLevel=5
codename1.mainName=Medi
codename1.packageName=com.my.medi
codename1.rim.certificatePassword=
codename1.rim.signtoolCsk=
codename1.rim.signtoolDb=
codename1.secondaryTitle=Medi
codename1.vendor=CodenameOne
codename1.version=1.0
libVersion=203

我不知道现在该怎么办。请指教。



编辑: Logcat输出如下:

01-23 01:37:13.051 6001-6018/com.my.medi D/CN1 Maps: Initializing maps
01-23 01:37:13.099 6001-6001/com.my.medi I/zzy: Making Creator dynamically
01-23 01:37:13.114 6001-6001/com.my.medi I/zygote: The ClassLoaderContext is a special shared library.
01-23 01:37:13.118 6001-6001/com.my.medi I/chatty: uid=10081(com.my.medi) identical 1 line
01-23 01:37:13.122 6001-6001/com.my.medi I/zygote: The ClassLoaderContext is a special shared library.
01-23 01:37:13.260 6001-6006/com.my.medi I/zygote: Do partial code cache collection, code=114KB, data=93KB
01-23 01:37:13.263 6001-6006/com.my.medi I/zygote: After code cache collection, code=114KB, data=93KB
01-23 01:37:13.263 6001-6006/com.my.medi I/zygote: Increasing code cache capacity to 512KB
01-23 01:37:13.274 6001-6001/com.my.medi W/zygote: Unsupported class loader
01-23 01:37:13.326 6001-6001/com.my.medi W/zygote: Skipping duplicate class check due to unsupported classloader
01-23 01:37:13.412 6001-6001/com.my.medi I/Google Maps Android API: Google Play services client version: 8298000
01-23 01:37:13.429 6001-6001/com.my.medi I/Google Maps Android API: Google Play services package version: 11580470
01-23 01:37:13.551 6001-6001/com.my.medi E/Google Maps Android API: Google Maps Android API v2 only supports devices with OpenGL ES 2.0 and above
01-23 01:37:13.750 6001-6001/com.my.medi I/Google Maps Android API: Google Play services package version: 11580470
01-23 01:37:13.809 6001-6001/com.my.medi I/Choreographer: Skipped 42 frames!  The application may be doing too much work on its main thread.
01-23 01:37:13.851 6001-6001/com.my.medi I/Google Maps Android API: Google Play services package version: 11580470
01-23 01:37:13.957 6001-6018/com.my.medi I/System.out: SQL Query: SELECT * FROM AspTable WHERE (Lat BETWEEN 0.0 AND 0.0) AND (Lnt BETWEEN 0.0 AND 0.0)
01-23 01:37:14.085 6001-6018/com.my.medi I/System.out: SQL Query: SELECT * FROM AspTable WHERE (Lat BETWEEN 0.0 AND 0.0) AND (Lnt BETWEEN 0.0 AND 0.0)
01-23 01:37:14.366 6001-6071/com.my.medi D/EGL_emulation: eglCreateContext: 0x966589e0: maj 1 min 0 rcv 1
01-23 01:37:14.874 6001-6071/com.my.medi D/EGL_emulation: eglMakeCurrent: 0x966589e0: ver 1 0 (tinfo 0x96663380)
01-23 01:37:15.151 6001-6001/com.my.medi I/Choreographer: Skipped 55 frames!  The application may be doing too much work on its main thread.

                                                          [ 01-23 01:37:15.170  6001: 6064 D/         ]
                                                          HostConnection::get() New Host Connection established 0x8d2d2740, tid 6064
01-23 01:37:15.182 6001-6064/com.my.medi D/EGL_emulation: eglCreateContext: 0x8ce859e0: maj 1 min 0 rcv 1
01-23 01:37:15.492 6001-6064/com.my.medi D/EGL_emulation: eglMakeCurrent: 0x8ce859e0: ver 1 0 (tinfo 0x96663630)
01-23 01:37:15.730 6001-6059/com.my.medi W/DynamiteModule: Local module descriptor class for com.google.android.gms.googlecertificates not found.
01-23 01:37:15.731 6001-6059/com.my.medi W/DynamiteModule: Failed to load module via V2: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.dynamite.DynamiteModule$DynamiteLoaderClassLoader" on path: DexPathList[[zip file "/data/app/com.my.medi-Sd9oSMBfGaQ8_lajDB7WUA==/base.apk"],nativeLibraryDirectories=[/data/app/com.my.medi-Sd9oSMBfGaQ8_lajDB7WUA==/lib/x86, /system/lib, /vendor/lib]]
01-23 01:37:15.746 6001-6059/com.my.medi I/DynamiteModule: Considering local module com.google.android.gms.googlecertificates:0 and remote module com.google.android.gms.googlecertificates:4
01-23 01:37:15.746 6001-6059/com.my.medi I/DynamiteModule: Selected remote version of com.google.android.gms.googlecertificates, version >= 4
01-23 01:37:15.770 6001-6059/com.my.medi W/zygote: Unsupported class loader
01-23 01:37:15.817 6001-6059/com.my.medi W/zygote: Skipping duplicate class check due to unsupported classloader
01-23 01:37:16.310 6001-6066/com.my.medi W/zygote: Long monitor contention with owner androidmapsapi-ula-1 (6059) at int java.io.UnixFileSystem.getBooleanAttributes0(java.lang.String)(UnixFileSystem.java:-2) waiters=0 in boolean in.a() for 474ms
01-23 01:38:05.450 6001-6018/com.my.medi D/Codename One: native focus gain

我不确定“缺少类加载器部分”是否相关。提前致谢





编辑编辑

事实证明,这只是Android工作室显示won't run unless you update the Google Play Service错误的另一种方式,其中使用API​​版本21(Android 5.0)解决了这个问题。需要做的设备测试

1 个答案:

答案 0 :(得分:1)

如果本机配置与JavaScript配置不匹配或初始化失败,则会出现此问题。调试它的一个技巧是连接电缆并使用DDMS / logcat查看输出。当事情无法正常工作时,Google通常会打印出错误。

请注意,您使用的AIza__________________________________值必须是3个不同的值。一个用于原生Android应用,一个用于原生iOS应用,另一个用于网络。