启动Android Studio 2.1活动时出错

时间:2016-05-04 08:22:14

标签: java android android-studio

由于我已经将Android Studio从1.5更新到2.1,因此我很多时候都会收到以下错误(并非总是如此)。这是" Run"的输出。对话框:

05/04 10:15:14: Launching app 
$ adb push C:\Users\Sition\AndroidStudioProjects\DigginTemp\app\build\outputs\apk\app-debug.apk /data/local/tmp/com.example.sition.diggintemp
$ adb shell pm install -r "/data/local/tmp/com.example.sition.diggintemp"
pkg: /data/local/tmp/com.example.sition.diggintemp
Success

$ adb shell am start -n "com.example.sition.diggintemp/com.example.sition.diggintemp.StartActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Unexpected error while executing: am start -n "com.example.sition.diggintemp/com.example.sition.diggintemp.StartActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Error while Launching activity

但奇怪的是,在logcat中找不到任何东西。 我真的不知道是什么导致了这种情况,因为错误并没有说明什么是错误的,因为StartActivity的启动出错了(我几乎没有改变或者自更新以来甚至根本没有。)

我的清单文件:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.sition.diggintemp"
    android:versionCode="5"
    android:versionName="0.2">

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.RECORD_VIDEO" />
    <uses-permission android:name="android.permission.RECORD_AUDIO" />

    <uses-feature android:name="android.hardware.camera" />
    <uses-feature android:name="android.hardware.camera.autofocus" />

    <application
        android:name=".misc.AppController"
        android:allowBackup="true"
        android:fullBackupContent="true"
        android:icon="@drawable/app_icon"
        android:label="@string/app_name"
        android:largeHeap="true"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity android:name=".StartActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity
            android:name=".MainActivity"
            android:configChanges="keyboardHidden|orientation|screenSize" />
        <activity android:name=".LoginActivity" />
        <activity
            android:name=".LoadActivity"
            android:configChanges="keyboardHidden|orientation|screenSize" />
        <activity android:name=".ProjectOverviewActivity" />
        <activity android:name=".CameraActivity" />
        <activity android:name=".VideoActivity" />
    </application>

</manifest>

有人知道如何解决这个问题吗?

修改

从logcat中删除过滤器后,我得到了一些输出,这是一部分:

05-04 11:59:57.585 540-1126/? D/dalvikvm: GC_EXPLICIT freed 249K, 17% free 67587K/80892K, paused 8ms+53ms, total 657ms
05-04 11:59:57.984 3427-3427/? I/dalvikvm: Turning on JNI app bug workarounds for target SDK version 8...
05-04 11:59:58.273 540-744/? W/LicenseLogService: log() is called by non admin
05-04 11:59:58.281 540-744/? W/LicenseLogService: log() is called by non admin
05-04 11:59:58.289 540-652/? D/ECS_EnterpriseContainerService: <<< Intent action is >>> : android.intent.action.PACKAGE_ADDED
05-04 11:59:58.289 540-652/? D/ECS_EnterpriseContainerService: <<< Intent data is   >>> : package:com.example.sition.diggintemp
05-04 11:59:58.289 540-652/? I/ECS_EnterpriseContainerService: Inside package added listener
05-04 11:59:58.296 540-652/? I/Monitor: SIOP:: Current AP = 0, CP = 0, PST = 300
05-04 11:59:58.296 540-652/? D/BatteryService: Sending ACTION_BATTERY_CHANGED.
05-04 11:59:58.304 786-786/? D/STATUSBAR-BatteryController: onReceive() - ACTION_BATTERY_CHANGED
05-04 11:59:58.304 786-786/? D/STATUSBAR-BatteryController: onReceive() - BATTERY_STATUS_FULL:
05-04 11:59:58.312 25355-25355/? V/CircleBatteryWidget: Valeur recuperee a partir de l'intent
05-04 11:59:58.312 25355-25355/? V/CircleBatteryWidget: Valeur recuperee : 100
05-04 11:59:58.429 3308-3308/? I/BaseStore: ConfigStore database version: 1
05-04 11:59:58.445 540-689/? W/Resources: Converting to string: TypedValue{t=0x12/d=0xffffffff a=-1}
05-04 11:59:58.734 786-786/? D/STATUSBAR-PhoneStatusBar:  mBrightnessEnablebySettings = true mBrightnessEnablebyBattery = true mBrightnessEnablebyDisableFlag = true
05-04 11:59:58.820 25355-25355/? V/CircleBatteryWidget: Widget W :108
05-04 11:59:58.820 25355-25355/? V/CircleBatteryWidget: Widget H :108
05-04 11:59:58.820 25355-25355/? V/CircleBatteryWidget: Bitmap W :108
05-04 11:59:58.820 25355-25355/? V/CircleBatteryWidget: Bitmap H :108
05-04 11:59:58.992 3308-3308/? I/dalvikvm: Could not find method android.database.Cursor.getNotificationUri, referenced from method com.google.android.music.utils.ColumnIndexableCursor.getNotificationUri
05-04 11:59:58.992 3308-3308/? W/dalvikvm: VFY: unable to resolve interface method 931: Landroid/database/Cursor;.getNotificationUri ()Landroid/net/Uri;
05-04 11:59:58.992 3308-3308/? D/dalvikvm: VFY: replacing opcode 0x72 at 0x0002
05-04 11:59:59.101 3427-3427/? I/PCWCLIENTTRACE_LOG: DEFAULT_LOGON : true
05-04 11:59:59.101 3427-3427/? I/PCWCLIENTTRACE_LOG: DEFAULT_LOGLEVEL : 3
05-04 11:59:59.101 3427-3427/? I/PCWCLIENTTRACE_PushUtil: SPPPushClient is installed : true
05-04 11:59:59.101 3427-3427/? I/PCWCLIENTTRACE_PushUtil: sales region : global
05-04 11:59:59.109 3427-3427/? I/PCWCLIENTTRACE_PushUtil: getPushTypeList : [SPP, GCM]
05-04 11:59:59.109 3427-3427/? I/PCWCLIENTTRACE_SYSTEMReceiver: [onReceive] - android.intent.action.PACKAGE_ADDED
05-04 11:59:59.203 3308-3308/? I/dalvikvm: Could not find method android.database.Cursor.setExtras, referenced from method com.google.android.music.utils.ColumnIndexableCursor.setExtras
05-04 11:59:59.203 3308-3308/? W/dalvikvm: VFY: unable to resolve interface method 953: Landroid/database/Cursor;.setExtras (Landroid/os/Bundle;)V
05-04 11:59:59.203 3308-3308/? D/dalvikvm: VFY: replacing opcode 0x72 at 0x0002
05-04 11:59:59.203 3308-3308/? I/dalvikvm: Could not find method android.database.Cursor.setExtras, referenced from method com.google.android.music.utils.ColumnIndexableCursor.setExtrasInternal
05-04 11:59:59.203 3308-3308/? W/dalvikvm: VFY: unable to resolve interface method 953: Landroid/database/Cursor;.setExtras (Landroid/os/Bundle;)V

这是另一部分:

05-04 12:00:01.664 3440-3440/? D/Spen: SpenSdk jar version = 55
05-04 12:00:01.664 3440-3440/? D/Spen: You SHOULD INSTALL SpenSdk apk file !!!!
05-04 12:00:01.664 3440-3440/? W/System.err: com.samsung.android.sdk.SsdkUnsupportedException: SpenSdk apk is not installed.
05-04 12:00:01.828 3440-3440/? W/System.err:     at com.samsung.android.sdk.pen.Spen.initialize(Spen.java:202)
05-04 12:00:01.828 3440-3440/? W/System.err:     at com.samsung.android.sdk.pen.Spen.initialize(Spen.java:114)
05-04 12:00:01.828 3440-3440/? W/System.err:     at com.sec.samsung.gallery.app.imagenote.photonote.NoteSpenSurfaceView.initializeSPenSDK(NoteSpenSurfaceView.java:118)
05-04 12:00:01.835 3440-3440/? W/System.err:     at com.sec.samsung.gallery.app.imagenote.photonote.PhotoNoteUtils.isSpenSdk30Supported(PhotoNoteUtils.java:56)
05-04 12:00:01.835 3440-3440/? W/System.err:     at com.sec.android.gallery3d.util.GalleryFeature.checkEnableNote(GalleryFeature.java:1546)
05-04 12:00:01.835 3440-3440/? W/System.err:     at com.sec.android.gallery3d.util.GalleryFeature.init(GalleryFeature.java:428)
05-04 12:00:01.835 3440-3440/? W/System.err:     at com.sec.android.gallery3d.app.GalleryAppImpl.getDataManager(GalleryAppImpl.java:229)
05-04 12:00:01.835 3440-3440/? W/System.err:     at com.sec.android.gallery3d.provider.GalleryProvider.onCreate(GalleryProvider.java:126)
05-04 12:00:01.835 3440-3440/? W/System.err:     at android.content.ContentProvider.attachInfo(ContentProvider.java:1058)
05-04 12:00:01.835 3440-3440/? W/System.err:     at android.app.ActivityThread.installProvider(ActivityThread.java:5067)
05-04 12:00:01.835 3440-3440/? W/System.err:     at android.app.ActivityThread.installContentProviders(ActivityThread.java:4679)
05-04 12:00:01.835 3440-3440/? W/System.err:     at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4592)
05-04 12:00:01.835 3440-3440/? W/System.err:     at android.app.ActivityThread.access$1400(ActivityThread.java:158)
05-04 12:00:01.835 3440-3440/? W/System.err:     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1356)
05-04 12:00:01.835 3440-3440/? W/System.err:     at android.os.Handler.dispatchMessage(Handler.java:99)
05-04 12:00:01.835 3440-3440/? W/System.err:     at android.os.Looper.loop(Looper.java:176)
05-04 12:00:01.843 3440-3440/? W/System.err:     at android.app.ActivityThread.main(ActivityThread.java:5365)
05-04 12:00:01.843 3440-3440/? W/System.err:     at java.lang.reflect.Method.invokeNative(Native Method)
05-04 12:00:01.843 3440-3440/? W/System.err:     at java.lang.reflect.Method.invoke(Method.java:511)
05-04 12:00:01.851 3440-3440/? W/System.err:     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102)
05-04 12:00:01.851 3440-3440/? W/System.err:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869)
05-04 12:00:01.851 3440-3440/? W/System.err:     at dalvik.system.NativeStart.main(Native Method)

另一部分:

05-04 12:00:06.429 3487-3487/? I/SA: [DM] init START
05-04 12:00:06.437 3487-3487/? I/SA: [DM] This device is not a Vodafone
05-04 12:00:06.460 3487-3487/? W/ResourceType: Failure getting entry for 0x7f060000 (t=5 e=0) in package 0 (error -75)
05-04 12:00:06.460 3487-3487/? W/ResourceType: Failure getting entry for 0x7f060001 (t=5 e=1) in package 0 (error -75)
05-04 12:00:06.460 3487-3487/? W/ResourceType: No package identifier when getting value for resource number 0x00000000
05-04 12:00:06.468 3487-3487/? W/ResourceType: No package identifier when getting value for resource number 0x00000000
05-04 12:00:06.468 3487-3487/? W/ResourceType: Failure getting entry for 0x7f060003 (t=5 e=3) in package 0 (error -75)
05-04 12:00:06.468 3487-3487/? W/ResourceType: Failure getting entry for 0x7f060004 (t=5 e=4) in package 0 (error -75)
05-04 12:00:06.468 3487-3487/? W/ResourceType: Failure getting entry for 0x7f060005 (t=5 e=5) in package 0 (error -75)
05-04 12:00:06.468 3487-3487/? W/ResourceType: Failure getting entry for 0x7f060006 (t=5 e=6) in package 0 (error -75)
05-04 12:00:06.468 3487-3487/? W/ResourceType: Failure getting entry for 0x7f060007 (t=5 e=7) in package 0 (error -75)
05-04 12:00:06.468 3487-3487/? W/ResourceType: Failure getting entry for 0x7f060008 (t=5 e=8) in package 0 (error -75)
05-04 12:00:06.476 3487-3487/? W/ResourceType: Failure getting entry for 0x7f060009 (t=5 e=9) in package 0 (error -75)
05-04 12:00:06.476 3487-3487/? W/ResourceType: Failure getting entry for 0x7f06000a (t=5 e=10) in package 0 (error -75)
05-04 12:00:06.476 3487-3487/? W/ResourceType: Failure getting entry for 0x7f06000d (t=5 e=13) in package 0 (error -75)
05-04 12:00:06.476 3487-3487/? W/ResourceType: Failure getting entry for 0x7f060012 (t=5 e=18) in package 0 (error -75)
05-04 12:00:06.484 3487-3487/? W/ResourceType: Failure getting entry for 0x7f060013 (t=5 e=19) in package 0 (error -75)
05-04 12:00:06.484 3487-3487/? W/ResourceType: Failure getting entry for 0x7f060014 (t=5 e=20) in package 0 (error -75)
05-04 12:00:06.484 3487-3487/? W/ResourceType: Failure getting entry for 0x7f060015 (t=5 e=21) in package 0 (error -75)
05-04 12:00:06.484 3487-3487/? W/ResourceType: Failure getting entry for 0x7f060016 (t=5 e=22) in package 0 (error -75)
05-04 12:00:06.484 3487-3487/? W/ResourceType: Failure getting entry for 0x7f060017 (t=5 e=23) in package 0 (error -75)
05-04 12:00:06.492 3487-3487/? W/ResourceType: Failure getting entry for 0x7f060018 (t=5 e=24) in package 0 (error -75)
05-04 12:00:06.492 3487-3487/? W/ResourceType: No package identifier when getting value for resource number 0x00000000
05-04 12:00:06.500 3487-3487/? W/ResourceType: Failure getting entry for 0x7f060019 (t=5 e=25) in package 0 (error -75)
05-04 12:00:06.500 3487-3487/? W/ResourceType: No package identifier when getting value for resource number 0x00000000
05-04 12:00:06.500 3487-3487/? W/ResourceType: Failure getting entry for 0x7f06001a (t=5 e=26) in package 0 (error -75)
05-04 12:00:06.500 3487-3487/? W/ResourceType: Failure getting entry for 0x7f06001b (t=5 e=27) in package 0 (error -75)
05-04 12:00:06.507 3487-3487/? W/ResourceType: Failure getting entry for 0x7f06001d (t=5 e=29) in package 0 (error -75)
05-04 12:00:06.507 3487-3487/? W/ResourceType: Failure getting entry for 0x7f06001e (t=5 e=30) in package 0 (error -75)
05-04 12:00:06.507 3487-3487/? W/ResourceType: Failure getting entry for 0x7f06001f (t=5 e=31) in package 0 (error -75)
05-04 12:00:06.507 3487-3487/? W/ResourceType: Failure getting entry for 0x7f060020 (t=5 e=32) in package 0 (error -75)
05-04 12:00:06.507 3487-3487/? W/ResourceType: Failure getting entry for 0x7f060022 (t=5 e=34) in package 0 (error -75)
05-04 12:00:06.507 3487-3487/? W/ResourceType: Failure getting entry for 0x7f060023 (t=5 e=35) in package 0 (error -75)
05-04 12:00:06.515 3487-3487/? W/ResourceType: Failure getting entry for 0x7f060025 (t=5 e=37) in package 0 (error -75)
05-04 12:00:06.515 3487-3487/? W/ResourceType: Failure getting entry for 0x7f060026 (t=5 e=38) in package 0 (error -75)
05-04 12:00:06.515 3487-3487/? W/ResourceType: Failure getting entry for 0x7f060027 (t=5 e=39) in package 0 (error -75)
05-04 12:00:06.523 3487-3487/? W/ResourceType: Failure getting entry for 0x7f060028 (t=5 e=40) in package 0 (error -75)
05-04 12:00:06.523 3487-3487/? W/ResourceType: Failure getting entry for 0x7f06002a (t=5 e=42) in package 0 (error -75)
05-04 12:00:06.523 3487-3487/? W/ResourceType: Failure getting entry for 0x7f06002c (t=5 e=44) in package 0 (error -75)
05-04 12:00:06.523 3487-3487/? W/ResourceType: Failure getting entry for 0x7f06002b (t=5 e=43) in package 0 (error -75)
05-04 12:00:06.523 3487-3487/? W/ResourceType: Failure getting entry for 0x7f06002d (t=5 e=45) in package 0 (error -75)
05-04 12:00:06.531 3487-3487/? W/ResourceType: Failure getting entry for 0x7f06002f (t=5 e=47) in package 0 (error -75)
05-04 12:00:06.531 3487-3487/? W/ResourceType: Failure getting entry for 0x7f06002e (t=5 e=46) in package 0 (error -75)
05-04 12:00:06.531 3487-3487/? W/ResourceType: Failure getting entry for 0x7f060031 (t=5 e=49) in package 0 (error -75)
05-04 12:00:06.578 3487-3487/? I/SA: support phone number id : true
05-04 12:00:06.578 3487-3487/? I/SA: [DM] Supports Ref Jpn : false
05-04 12:00:06.578 3487-3487/? I/SA: [DM] init END

我不确定如何修复它(我会调查它)

5 个答案:

答案 0 :(得分:1)

不确定,但您可以尝试禁用&#34;即时运行&#34;。要禁用&#34;即时运行&#34;,您可以转到首选项对话框(可能在Windows上设置对话框),然后选择&#34;构建,执行,部署&#34; - &GT; &#34;立即运行&#34;,并取消选中所有复选框以禁用&#34;即时运行&#34;。

答案 1 :(得分:1)

您可以按照here

重新启动android studio来解决您的问题

有时再次运行(不止一次)在我的情况下工作正常,然后其他后续运行成功。

答案 2 :(得分:1)

我认为这个问题是android studio的最新更新版本的一个错误,我遇到了同样的问题,上面没有一个是解决方案,上面所说的唯一有效的事情就是如果你&#34 ;使用Gradle文件同步项目&#34;在跑步之前,你必须一遍又一遍地做这件事。 对我来说,总是运行程序并在安装了apk之后发出错误并忽略错误并直接进入模拟器,找到您的项目/应用程序图标并点击或直接启动,它会在您完成所有更改后正常启动。这可能是一种解决方法,但它提供了结果

答案 3 :(得分:0)

有些设备只是停用应用程序而不是删除它,你必须在设置中采取额外的步骤(例如Samsumg Galaxy S6),所以可能需要仔细看看。

前一天我得到了同样的错误,在我认出之前试了一个小时......

答案 4 :(得分:0)

对我来说,点击“使用Gradle文件同步项目”按钮的解决方案如下所述:https://stackoverflow.com/a/29652750/3906364