Android的 - 无法找到的图形页面为例com.google.settings供应商信息为例、图形、供应商、页面

2023-09-13 00:42:08 作者:施虐者的爱

我想实现它在安卓你好定义的视图例子的MapView的例子,但现在我面临着这样的错误:

I'm trying to implement the MapView example which is defined in Android Hello Views example but now I'm facing this error:

Failed to find provider info for com.google.settings

任何想法,为什么会这样?

Any idea why this is happening?

推荐答案

的MapView例如不设置为默认的API密钥。所以,你必须将它。下面是一步一步:

The MapView example doesn't set API key by default. So you must set it. Here is step by step:

从系统中获取MD5

Get MD5 from your system

%JAVA_HOME%\bin\keytool.exe -list -alias androiddebugkey -keystore "%userprofile%\.android\debug.keystore" -storepass android -keypass android

获取API密钥通过粘贴生成MD5此页: http://$c$c.google.com/android/maps-api-signup.html

Get API key by pasting the generated MD5 to this page: http://code.google.com/android/maps-api-signup.html

粘贴生成的API密钥为 {} your_project_root /res/layout/map.xml

Paste the generated API key to {your_project_root}/res/layout/map.xml

<com.google.android.maps.MapView
    android:id="@+id/myMapView"
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent"
    android:enabled="true"
    android:clickable="true"
    android:apiKey="paste_generated_api_key_here"
/>

谷歌 Android 12 Beta 5 发布 诸多细节改动,正式版即将到来

在 AndroidManifest.xml中,请确保您有如下因素标记到你的应用程序标签:

In AndroidManifest.xml, make sure that you have the folowing tag into your application tag:

<uses-library android:name="com.google.android.maps" />

也是如下因素标记到你的清单标签:

<uses-permission android:name="android.permission.INTERNET" />

刷新项目和运行

Refresh your project and run

请注意:

的keytool.exe的,debug.keystore和map.xml的路径可能会有所不同您的系统上。 如果您发布的应用程序时,一定要注册其他API密钥。 如果您没有设置API密钥正确,你的应用程序将无法在手机上也可能是错误消息的 ...已意外停止,请重试。 - 强行关闭的

更详细地http://d.android.com/guide/tutorials/views/hello-mapview.html