我在project.prperties下面的行中没有注释
proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
Run Code Online (Sandbox Code Playgroud)
工作进展,它工作正常.
但是当我添加android-support-v4.jar库时,导出已签名的应用程序项目时出错
Launch canceled!
Proguard returned with error code 1. See console
Note: there were 316 duplicate class definitions.
Warning: com.google.android.gms.common.images.ImageManager$a: can't find superclass or interface android.content.ComponentCallbacks2
Warning: com.google.android.gms.maps.MapFragment: can't find superclass or interface android.app.Fragment
Warning: com.google.android.gms.common.GooglePlayServicesUtil: can't find referenced field 'int smallestScreenWidthDp' in class android.content.res.Configuration
Warning: com.google.android.gms.common.images.ImageManager: can't find referenced method 'void registerComponentCallbacks(android.content.ComponentCallbacks)' in class android.content.Context
Warning: com.google.android.gms.common.images.ImageManager$a: can't find referenced class android.content.ComponentCallbacks2
Warning: com.google.android.gms.maps.MapFragment: can't find referenced class android.app.Fragment
Warning: com.google.android.gms.maps.MapFragment: can't find referenced class android.app.Fragment …Run Code Online (Sandbox Code Playgroud) 我的活动代码
package com.example.testmap;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.view.Menu;
import com.google.android.gms.maps.SupportMapFragment;
public class MainActivity extends FragmentActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
}
Run Code Online (Sandbox Code Playgroud)
xml文件代码
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/hello_world" />
<fragment
android:id="@+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginRight="150dp"
class="com.google.android.gms.maps.SupportMapFragment" />
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)
和清单代码
<?xml version="1.0" encoding="utf-8"?>
Run Code Online (Sandbox Code Playgroud)
<uses-sdk
android:minSdkVersion="9"
android:targetSdkVersion="17" />
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<permission
android:name="android.os.Bundle.permission.MAPS_RECEIVE"
android:protectionLevel="signature" /> …Run Code Online (Sandbox Code Playgroud) 我使用Google Maps Android v1 API创建了我的应用程序的第一个版本.但现在,当我发布第二版的应用程序时,Google地图停止了工作.我认为这是因为它被弃用了.
所以现在我正在尝试使用链接创建示例Android应用程序以使用Google Map
https://developers.google.com/maps/documentation/android/start#getting_the_google_maps_android_api_v2
Run Code Online (Sandbox Code Playgroud)
但是我正在低于力量关闭错误
FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.testmap/com.example.testmap.MainActivity}: android.view.InflateException: Binary XML file line #16: Error inflating class fragment
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1651)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1667)
at android.app.ActivityThread.access$1500(ActivityThread.java:117)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:935)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:130)
at android.app.ActivityThread.main(ActivityThread.java:3687)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:625)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.view.InflateException: Binary XML file line #16: Error inflating class fragment
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:581)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:623)
at android.view.LayoutInflater.inflate(LayoutInflater.java:408)
at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:209)
at android.app.Activity.setContentView(Activity.java:1657) …Run Code Online (Sandbox Code Playgroud)