未能在设备的模拟器上安装apk

我知道这个问题已经被问了很多次,但是没有一个解决方案似乎对我有用。 我试图制作一个应用程序,该应用程序在启动时显示Google地图,但每次尝试在我的设备中启动时都会停止应用程序。 我试图重新启动我的模拟器几次,并尝试在仿真器中安装apk几次,但未能安装。

这里是我的logcat输出: -

   11-11 02:30:00.317: I/Choreographer(1025): Skipped 85 frames!  The                                    application may be doing too much work on its main thread.                       
   11-11 02:30:17.937: D/AndroidRuntime(1465): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
   11-11 02:30:18.049: D/AndroidRuntime(1465): CheckJNI is ON
   11-11 02:30:19.803: E/memtrack(1465): Couldn't load memtrack module (No such file or directory)
   11-11 02:30:19.804: E/android.os.Debug(1465): failed to load memtrack module: -2
   11-11 02:30:20.528: D/AndroidRuntime(1465): Calling main entry com.android.commands.pm.Pm
   11-11 02:30:21.191: D/DefContainer(699): Copying /data/local/tmp/Map1.apk to base.apk
   11-11 02:30:21.940: I/PackageParser(351): com.example.map1: compat added       android.permission.READ_PHONE_STATE
   11-11 02:30:22.492: I/art(351): Background sticky concurrent mark sweep GC freed 8852(660KB) AllocSpace objects, 10(276KB) LOS objects, 15% free, 7MB/8MB, paused 6.889ms total 157.656ms
   11-11 02:30:27.443: I/art(351): Background sticky concurrent mark sweep GC freed 22779(835KB) AllocSpace objects, 3(75KB) LOS objects, 10% free, 7MB/8MB, paused 6.491ms total 170.123ms
   11-11 02:30:28.229: I/art(351): Background sticky concurrent mark sweep GC freed 4848(221KB) AllocSpace objects, 5(167KB) LOS objects, 5% free, 8MB/8MB, paused 7.096ms total 139.759ms
   11-11 02:30:28.410: D/PackageManager(351): Renaming /data/app/vmdl872362061.tmp to /data/app/com.example.map1-3
   11-11 02:30:28.513: I/ActivityManager(351): Force stopping com.example.map1 appid=10061 user=-1: uninstall pkg
   11-11 02:30:28.814: I/art(351): Background sticky concurrent mark sweep GC freed 2233(152KB) AllocSpace objects, 0(0B) LOS objects, 3% free, 8MB/8MB, paused 11.324ms total 68.953ms
   11-11 02:30:29.040: I/PackageManager(351): Package com.example.map1 codePath changed from /data/app/com.example.map1-1 to /data/app/com.example.map1-3; Retaining data and using new
   11-11 02:30:29.262: I/art(351): DexFile_isDexOptNeeded failed to open oat file '/data/dalvik-cache/arm/data@app@com.example.map1-3@base.apk@classes.dex' for file location '/data/app/com.example.map1-3/base.apk': Failed to open oat filename for reading: No such file or directory
   11-11 02:30:29.270: I/art(351): DexFile_isDexOptNeeded failed to open oat file '/data/app/com.example.map1-3/arm/base.odex' for file location '/data/app/com.example.map1-3/base.apk': Failed to open oat filename for reading: No such file or directory
   11-11 02:30:29.271: I/PackageManager(351): Running dexopt on: /data/app/com.example.map1-3/base.apk pkg=com.example.map1 isa=arm vmSafeMode=false
   11-11 02:30:29.749: I/dex2oat(1476): /system/bin/dex2oat --zip-fd=6 --zip-location=/data/app/com.example.map1-3/base.apk --oat-fd=7 --oat-location=/data/dalvik-cache/arm/data@app@com.example.map1-3@base.apk@classes.dex --instruction-set=arm --instruction-set-features=default --runtime-arg -Xms64m --runtime-arg -Xmx512m
   11-11 02:30:37.467: I/art(351): Background sticky concurrent mark sweep GC freed 1520(182KB) AllocSpace objects, 1(16KB) LOS objects, 3% free, 8MB/8MB, paused 16.720ms total 235.626ms
   11-11 02:30:43.765: W/dex2oat(1476): Before Android 4.1, method int android.support.v7.internal.widget.ListViewCompat.lookForSelectablePosition(int, boolean) would have incorrectly overridden the package-private method in android.widget.ListView
   11-11 02:30:58.559: W/dex2oat(1476): Verification of java.lang.String android.support.v4.app.FragmentTabHost$SavedState.toString() took 100.137ms
   11-11 02:31:00.358: W/dex2oat(1476): Verification of void android.support.v4.media.session.MediaSessionCompat$Token.<init>(java.lang.Object) took 343.659ms
   11-11 02:31:01.044: W/dex2oat(1476): Verification of void android.support.v4.media.session.MediaSessionCompat$Token.writeToParcel(android.os.Parcel, int) took 682.459ms
   11-11 02:31:01.220: W/dex2oat(1476): Verification of android.support.v4.media.session.MediaSessionCompat android.support.v4.media.session.MediaSessionCompat.obtain(android.content.Context, java.lang.Object) took 168.135ms
   11-11 02:31:17.160: I/art(595): Background sticky concurrent mark sweep GC freed 8483(413KB) AllocSpace objects, 0(0B) LOS objects, 24% free, 1608KB/2MB, paused 4.648ms total 208.707ms
   11-11 02:31:17.163: W/dex2oat(1476): Verification of java.util.ArrayList com.google.android.gms.location.places.internal.zzo.zzd(com.google.android.gms.location.places.internal.zzo) took 290.814ms
   11-11 02:31:17.483: W/dex2oat(1476): Verification of com.google.android.gms.location.places.personalized.PlaceUserData com.google.android.gms.location.places.personalized.zze.zzeG(android.os.Parcel) took 128.367ms
   11-11 02:31:19.315: W/dex2oat(1476): Verification of com.google.android.gms.plus.internal.model.moments.ItemScopeEntity com.google.android.gms.plus.internal.model.moments.zza.zzfK(android.os.Parcel) took 475.791ms
   11-11 02:31:19.436: W/dex2oat(1476): Verification of com.google.android.gms.plus.internal.model.moments.MomentEntity com.google.android.gms.plus.internal.model.moments.zzb.zzfL(android.os.Parcel) took 107.922ms
   11-11 02:31:19.667: W/dex2oat(1476): Verification of com.google.android.gms.plus.internal.model.people.PersonEntity com.google.android.gms.plus.internal.model.people.zza.zzfM(android.os.Parcel) took 169.941ms
   11-11 02:31:30.232: W/dex2oat(1476): Verification of boolean com.google.android.gms.games.internal.IGamesService$Stub.onTransact(int, android.os.Parcel, android.os.Parcel, int) took 170.909ms
   11-11 02:31:31.054: W/dex2oat(1476): Verification of void com.google.android.gms.internal.zzai$zzb.zzc(byte[], byte[]) took 327.400ms
   11-11 02:31:31.434: W/dex2oat(1476): Verification of void com.google.android.gms.internal.zzai$zzc.zzc(byte[], byte[]) took 275.692ms
   11-11 02:31:31.817: W/dex2oat(1476): Verification of void com.google.android.gms.internal.zzai$zzd.zzc(byte[], byte[]) took 280.942ms
   11-11 02:31:32.109: W/dex2oat(1476): Verification of void com.google.android.gms.internal.zzai$zze.zzc(byte[], byte[]) took 141.315ms
   11-11 02:31:33.161: W/dex2oat(1476): Verification of void com.google.android.gms.internal.zzai$zzf.zzc(byte[], byte[]) took 895.272ms
   11-11 02:31:34.304: W/dex2oat(1476): Verification of void com.google.android.gms.internal.zzai$zzg.zzc(byte[], byte[]) took 948.073ms
   11-11 02:31:34.697: W/dex2oat(1476): Verification of void com.google.android.gms.internal.zzai$zzh.zzc(byte[], byte[]) took 303.089ms
   11-11 02:31:35.096: W/dex2oat(1476): Verification of void com.google.android.gms.internal.zzai$zzi.zzc(byte[], byte[]) took 293.232ms
   11-11 02:31:35.483: W/dex2oat(1476): Verification of void com.google.android.gms.internal.zzai$zzj.zzc(byte[], byte[]) took 248.063ms
   11-11 02:31:35.819: W/dex2oat(1476): Verification of void com.google.android.gms.internal.zzai$zzk.zzc(byte[], byte[]) took 266.310ms
   11-11 02:31:36.226: W/dex2oat(1476): Verification of void com.google.android.gms.internal.zzai$zzl.zzc(byte[], byte[]) took 261.331ms
   11-11 02:31:36.609: W/dex2oat(1476): Verification of void com.google.android.gms.internal.zzai$zzm.zzc(byte[], byte[]) took 250.717ms
   11-11 02:31:51.611: W/dex2oat(1476): Compilation of void android.UnusedStub.<init>() took 110.472ms
   11-11 02:31:51.815: W/dex2oat(1476): Compilation of java.lang.String android.support.v4.accessibilityservice.AccessibilityServiceInfoCompat.capabilityToString(int) took 145.742ms
   11-11 02:32:00.375: W/dex2oat(1476): Compilation of java.util.List android.support.v4.view.accessibility.AccessibilityManagerCompat.getInstalledAccessibilityServiceList(android.view.accessibility.AccessibilityManager) took 352.172ms
   11-11 02:32:30.606: W/dex2oat(1476): Compilation of void com.google.android.gms.internal.zzqf$zze.<init>(java.util.List, java.util.List, java.util.List, java.util.List, java.util.List, java.util.List, java.util.List, java.util.List, java.util.List, java.util.List) took 146.855ms
   11-11 02:32:31.245: W/dex2oat(1476): Compilation of com.google.android.gms.internal.zzrc$zza$zza com.google.android.gms.internal.zzrb.zza(java.util.List, java.lang.Object) took 184.287ms
   11-11 02:32:32.218: W/dex2oat(1476): Compilation of int com.google.android.gms.internal.zzrg.zzc(int, com.google.android.gms.internal.zzrn) took 120.846ms
   11-11 02:32:34.452: W/dex2oat(1476): Compilation of void com.google.android.gms.internal.zzu.zza(byte[]) took 137.128ms
   11-11 02:32:41.305: I/art(351): Background sticky concurrent mark sweep GC freed 2425(171KB) AllocSpace objects, 0(0B) LOS objects, 2% free, 8MB/8MB, paused 7.155ms total 195.749ms
   11-11 02:32:41.440: I/art(351): Background sticky concurrent mark sweep GC freed 54(2656B) AllocSpace objects, 0(0B) LOS objects, 2% free, 8MB/8MB, paused 12.344ms total 129.632ms
   11-11 02:32:41.466: W/dex2oat(1476): Compilation of com.google.android.gms.plus.model.moments.ItemScope$Builder com.google.android.gms.plus.model.moments.ItemScope$Builder.setDuration(java.lang.String) took 425.054ms
   11-11 02:32:43.007: W/dex2oat(1476): Compilation of void com.google.android.gms.tagmanager.zza.zzb(com.google.android.gms.tagmanager.zza) took 224.996ms
   11-11 02:32:44.053: W/dex2oat(1476): Compilation of void com.google.android.gms.tagmanager.zzcp.<init>(android.content.Context, com.google.android.gms.internal.zzqf$zzc, com.google.android.gms.tagmanager.DataLayer, com.google.android.gms.tagmanager.zzt$zza, com.google.android.gms.tagmanager.zzt$zza, com.google.android.gms.tagmanager.zzah) took 101.172ms
   11-11 02:32:44.213: W/dex2oat(1476): Compilation of com.google.android.gms.tagmanager.zzbw com.google.android.gms.tagmanager.zzcp.zza(com.google.android.gms.internal.zzag$zza, java.util.Set, com.google.android.gms.tagmanager.zzdi) took 158.437ms
   11-11 02:32:46.901: W/dex2oat(1476): Compilation of com.google.android.gms.wearable.internal.GetChannelOutputStreamResponse[] com.google.android.gms.wearable.internal.zzah.zzkh(int) took 123.125ms
   11-11 02:32:55.490: W/dex2oat(1476): Compilation of boolean android.support.v7.app.AppCompatDelegateImplBase$AppCompatWindowCallback.onMenuOpened(int, android.view.Menu) took 207.450ms
   11-11 02:33:00.397: W/dex2oat(1476): Compilation of boolean android.support.v7.widget.Toolbar$ExpandedActionViewMenuPresenter.onSubMenuSelected(android.support.v7.internal.view.menu.SubMenuBuilder) took 384.889ms
   11-11 02:33:12.951: W/dex2oat(1476): Compilation of boolean com.google.android.gms.games.internal.IGamesCallbacks$Stub.onTransact(int, android.os.Parcel, android.os.Parcel, int) took 103.858ms
   11-11 02:33:14.826: W/dex2oat(1476): Compilation of boolean com.google.android.gms.games.internal.IGamesService$Stub.onTransact(int, android.os.Parcel, android.os.Parcel, int) took 411.768ms
   11-11 02:33:16.155: W/dex2oat(1476): Compilation of void com.google.android.gms.internal.zzai$zzb.zzc(byte[], byte[]) took 171.732ms
   11-11 02:33:16.426: W/dex2oat(1476): Compilation of void com.google.android.gms.internal.zzai$zzc.zzc(byte[], byte[]) took 247.101ms
   11-11 02:33:16.698: W/dex2oat(1476): Compilation of void com.google.android.gms.internal.zzai$zzd.zzc(byte[], byte[]) took 267.074ms
   11-11 02:33:16.981: W/dex2oat(1476): Compilation of void com.google.android.gms.internal.zzai$zzf.zzc(byte[], byte[]) took 135.380ms
   11-11 02:33:17.252: W/dex2oat(1476): Compilation of void com.google.android.gms.internal.zzai$zzg.zzc(byte[], byte[]) took 227.297ms
   11-11 02:33:17.529: W/dex2oat(1476): Compilation of void com.google.android.gms.internal.zzai$zzh.zzc(byte[], byte[]) took 258.643ms
   11-11 02:33:17.787: W/dex2oat(1476): Compilation of void com.google.android.gms.internal.zzai$zzi.zzc(byte[], byte[]) took 241.239ms
   11-11 02:33:18.036: W/dex2oat(1476): Compilation of void com.google.android.gms.internal.zzai$zzj.zzc(byte[], byte[]) took 233.587ms
   11-11 02:33:18.287: W/dex2oat(1476): Compilation of void      com.google.android.gms.internal.zzai$zzk.zzc(byte[], byte[]) took 246.552ms
   11-11 02:33:18.521: W/dex2oat(1476): Compilation of void com.google.android.gms.internal.zzai$zzl.zzc(byte[], byte[]) took 216.133ms
   11-11 02:33:18.814: W/dex2oat(1476): Compilation of void com.google.android.gms.internal.zzai$zzm.zzc(byte[], byte[]) took 279.531ms
   11-11 02:33:34.321: W/dex2oat(1476): Compilation of boolean com.google.android.gms.maps.model.internal.zzi$zza.onTransact(int, android.os.Parcel, android.os.Parcel, int) took 149.938ms
   11-11 02:33:35.036: W/dex2oat(1476): Compilation of boolean com.google.android.gms.maps.model.internal.zzj$zza$zza.isGeodesic() took 383.782ms
   11-11 02:33:52.509: W/dex2oat(1476): Compilation of java.lang.String com.google.android.gms.games.multiplayer.InvitationRef.getInvitationId() took 216.617ms
   11-11 02:33:52.713: W/dex2oat(1476): Compilation of com.google.android.gms.games.multiplayer.Participant com.google.android.gms.games.multiplayer.InvitationRef.getInviter() took 201.659ms

控制台输出: -

[2015-11-11 02:30:06 - Map1] ------------------------------
[2015-11-11 02:30:06 - Map1] Android Launch!
[2015-11-11 02:30:06 - Map1] adb is running normally.
[2015-11-11 02:30:06 - Map1] Performing com.example.map1.MainActivity activity launch
[2015-11-11 02:30:07 - Map1] Automatic Target Mode: using existing emulator 'emulator-5556' running compatible AVD 'mario'
[2015-11-11 02:30:07 - Map1] WARNING: Application does not specify an API level requirement!
[2015-11-11 02:30:07 - Map1] Device API version is 21 (Android 5.0.2)
[2015-11-11 02:30:07 - Map1] Uploading Map1.apk onto device 'emulator-5556'
[2015-11-11 02:30:15 - Map1] Installing Map1.apk...
[2015-11-11 02:32:32 - Map1] Failed to install Map1.apk on device 'emulator-5556!
[2015-11-11 02:32:32 - Map1] (null)
[2015-11-11 02:32:33 - Map1] Launch canceled!

MainActivity类: -

package com.example.map1;

import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.OnMapReadyCallback;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.MarkerOptions;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
public class MainActivity extends AppCompatActivity implements OnMapReadyCallback {

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    SupportMapFragment mapFragment =
            (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map);
    mapFragment.getMapAsync(this);
}

@Override
public void onMapReady(GoogleMap map) {
    map.addMarker(new MarkerOptions().position(new LatLng(0, 0)).title("Marker"));
}
}

activity_main.xml中: -

<?xml version="1.0" encoding="utf-8"?>
    <fragment xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/map"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        class="com.google.android.gms.maps.SupportMapFragment" />

ANDROID_MANIFEST: -

<?xml version="1.0" encoding="utf-8"?>
  <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.map1" >
  <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
  <uses-permission
    android:name="android.permission.WRITE_EXTERNAL_STORAGE"
    android:maxSdkVersion="22" />
  <uses-permission
    android:name="android.permission.READ_EXTERNAL_STORAGE"
    android:maxSdkVersion="22" />

  <application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <meta-data
        android:name="com.google.android.geo.API_KEY"
        android:value="AIzaSyCI6bvnLSQ_0DmNEZPn7w8J7FW7_j0nLAQ" />
    <activity
        android:name=".MainActivity"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
  </application>

</manifest>
链接地址: http://www.djcxy.com/p/24699.html

上一篇: Failed to install apk on device 'emulator

下一篇: I can't install apk from eclipse