1

我的手机上安装了一个 android 应用程序,我想通过 adb shell 启动其中一项活动。这是文件的清单:

编辑我还在所有清单代码和 adb 命令下方发布了 logcat 信息。它正在抛出 NullPointerException。

<?xml version="1.0" encoding="utf-8"?>
<manifest android:versionCode="2010100" android:versionName="2.1.1" package="com.aurorasoftworks.quadrant.ui.standard"
  xmlns:android="http://schemas.android.com/apk/res/android">
    <supports-screens android:anyDensity="true" android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" />
    <application android:label="@string/app_name" android:icon="@drawable/icon" android:name="com.aurorasoftworks.quadrant.ui.standard.QuadrantStandardApplication">
        <activity android:label="@string/app_name" android:name=".QuadrantStandardLauncherActivity" android:noHistory="true">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity android:label="@string/app_name" android:name=".QuadrantStandardActivity" />
        <activity android:label="@string/app_name" android:name="com.aurorasoftworks.quadrant.ui.runner.BenchmarkExecutionActivity" android:screenOrientation="portrait" android:noHistory="true" />
        <activity android:label="@string/app_name" android:name="com.aurorasoftworks.quadrant.ui.score.BenchmarkScoreActivity" />
        <activity android:label="@string/app_name" android:name="com.aurorasoftworks.quadrant.ui.browser.DeviceVendorListActivity" />
        <activity android:label="@string/app_name" android:name="com.aurorasoftworks.quadrant.ui.browser.DeviceListActivity" />
        <activity android:label="@string/app_name" android:name="com.aurorasoftworks.quadrant.ui.browser.DeviceStatsActivity" />
        <activity android:label="@string/app_name" android:name="com.aurorasoftworks.quadrant.ui.sysinfo.SystemInfoActivity" />
        <activity android:name="com.google.ads.AdActivity" android:configChanges="keyboard|keyboardHidden|orientation" />
    </application>
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.SET_ORIENTATION" />
</manifest>

我尝试使用以下命令启动 QuadrantStandardActivity:

adb shell am start -n com.aurorasoftworks.quadrant.ui.standard/.QuadrantStandardActivity

它奏效了。但是当我尝试连接到另一个活动时它失败了。我使用的命令是:

adb shell am start -n com.aurorasoftworks.quadrant.ui.standard/com.aurorasoftworks.quadrant.ui.runner.BenchmarkExecutionActivity

日志信息:

E/AndroidRuntime(11973): FATAL EXCEPTION: main

E/AndroidRuntime(11973): java.lang.NullPointerException

E/AndroidRuntime(11973):    at com.aurorasoftworks.quadrant.core.C.a(Unknown Source)

E/AndroidRuntime(11973):    at com.aurorasoftworks.quadrant.ui.runner.A.a(Unknown Source)

E/AndroidRuntime(11973):    at com.aurorasoftworks.quadrant.ui.runner.BenchmarkExecutionActivity.h(Unknown Source)

E/AndroidRuntime(11973):    at com.aurorasoftworks.quadrant.ui.runner.r.apply$mcV$sp(Unknown Source)

E/AndroidRuntime(11973):    at com.aurorasoftworks.quadrant.ui.runner.r.a(Unknown Source)

E/AndroidRuntime(11973):    at com.aurorasoftworks.quadrant.ui.runner.r.apply(Unknown Source)

E/AndroidRuntime(11973):    at com.aurorasoftworks.quadrant.util.r.run(Unknown Source)

E/AndroidRuntime(11973):    at android.os.Handler.handleCallback(Handler.java:725)

E/AndroidRuntime(11973):    at android.os.Handler.dispatchMessage(Handler.java:92)

E/AndroidRuntime(11973):    at android.os.Looper.loop(Looper.java:137)

E/AndroidRuntime(11973):    at android.app.ActivityThread.main(ActivityThread.java:5074)

E/AndroidRuntime(11973):    at java.lang.reflect.Method.invokeNative(Native Method)

E/AndroidRuntime(11973):    at java.lang.reflect.Method.invoke(Method.java:511)

E/AndroidRuntime(11973):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)

E/AndroidRuntime(11973):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)

E/AndroidRuntime(11973):    at dalvik.system.NativeStart.main(Native Method)

W/ActivityManager(  739):   Force finishing activity com.aurorasoftworks.quadrant.ui.standard/com.aurorasoftworks.quadrant.ui.runner.BenchmarkExecutionActivity

W/ActivityManager(  739):   Force finishing activity com.aurorasoftworks.quadrant.ui.standard/.QuadrantStandardActivity

W/ActivityManager(  739): Activity pause timeout for ActivityRecord{413150d0 u0 com.aurorasoftworks.quadrant.ui.standard/com.aurorasoftworks.quadrant.ui.runner.BenchmarkExecutionActivity}

I/ActivityManager(  739): Process com.aurorasoftworks.quadrant.ui.standard (pid 11973) has died.

我将不胜感激任何帮助

4

2 回答 2

0

当启动 BenchmarkExecutionActivity 时抛出 NullPointerException,检查代码为什么抛出异常。

于 2013-06-28T03:26:38.940 回答
0

.BenchmarkExecutionActivity

应该在

com.aurorasoftworks.quadrant.ui.standard

包裹。要么在清单的第一行更改您的包名称

package="com.aurorasoftworks.quadrant.ui.standard"

package="com.aurorasoftworks.quadrant.ui"

或者把那个活动放在里面

com.aurorasoftworks.quadrant.ui.standard

包裹。

于 2016-06-22T08:34:51.133 回答