我的简单“Hello World”应用程序在平板电脑三星 gt_3113(Android 4.2.2)上运行,但在我的手机 mi_4c(Android 5.1.1)上无法运行。我正在使用 Android Studio 2.2.2。为什么?
相关文件:
AndroidManifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.adc2017gmail.testmi4c">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
构建.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.0"
defaultConfig {
applicationId "com.adc2017gmail.testmi4c"
minSdkVersion 10
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.0.1'
testCompile 'junit:junit:4.12'
}
错误信息
11/27 16:01:54: Launching app
$ adb push C:\DREAM\TestMi4\app\build\outputs\apk\app-debug.apk /data/local/tmp/com.adc2017gmail.testmi4c
$ adb shell pm install -r "/data/local/tmp/com.adc2017gmail.testmi4c"
Aborted
$ adb shell am start -n "com.adc2017gmail.testmi4c/com.adc2017gmail.testmi4c.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Error while executing: am start -n "com.adc2017gmail.testmi4c/com.adc2017gmail.testmi4c.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.adc2017gmail.testmi4c/.MainActivity }
Error type 3
Error: Activity class {com.adc2017gmail.testmi4c/com.adc2017gmail.testmi4c.MainActivity} does not exist.
Error while Launching activity
我试图重新安装驱动程序,
- 清理项目
- 删除了构建目录
- 重新启动 Android Studio
- 重建项目
- 跑
从 Android Studio 2.2.2 跳转到 1.5.1