zes*_*shu 18 android google-maps map inflate android-mapview
我只是按照一个简单的地图教程http://developer.android.com/resources/tutorials/views/hello-mapview.html但收到此错误.我是android的新手我试图遵循通过互联网提供的所有解决方案,但还没有成功.请帮我.我的主要.xml在下面
<?xml version="1.0" encoding="utf-8"?>
<com.google.android.maps.MapView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/mapview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:clickable="true"
android:apiKey="***"
/>
Run Code Online (Sandbox Code Playgroud)
和manifestfile就是这个
Bob*_*obs 52
我遇到了这个问题并通过以下两个步骤解决了这个问题:
1)将以下行放在AndroidManifest.xml文件的application(important)元素中.
<uses-library android:name="com.google.android.maps" />
Run Code Online (Sandbox Code Playgroud)
2)扩展MapActivity而不是Activity.
请享用!
小智 12
您是否将主类扩展为MapActivity?
public class a extends MapActivity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
@Override
protected boolean isRouteDisplayed() {
// TODO Auto-generated method stub
return false;
}
}
Run Code Online (Sandbox Code Playgroud)
我有同样的问题,大约3个小时的搜索,这是我做的修复它,所有在清单.
1)在我的清单中,此代码不在正确的位置
<uses-library android:name="com.google.android.maps" />
Run Code Online (Sandbox Code Playgroud)
它应该在这里,在
<application>
Run Code Online (Sandbox Code Playgroud)
像这样
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.package.name">
...
<application android:name="MyApplication" >
<uses-library android:name="com.google.android.maps" />
...
</application>
...
</manifest>
Run Code Online (Sandbox Code Playgroud)
2)我在舱单的某个地方丢了一段时间
<activity
android:name="MyClass" //*****should be android:name=".MyClass"***
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MyClass />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
Run Code Online (Sandbox Code Playgroud)
3)我没有指定min sdk版本
<manifest>
Run Code Online (Sandbox Code Playgroud)
码:
<uses-sdk android:minSdkVersion="7" />
Run Code Online (Sandbox Code Playgroud)
4)在调试模式下通过eclipse使地图工作按照cmd或终端中的这些说明进行操作http://www.buzztouch.com/resources/Obtaining_a_Google_Maps_API_Key_v1.0.pdf
我希望这可以帮助别人