2016-11-27 112 views
1

我的簡單「Hello World」應用在平板電腦Samsung 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> 

的build.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 

我試圖重新安裝驅動程序,

  • 清理項目
  • 刪除build目錄
  • 重啓動的Android工作室
  • 重建項目
  • 運行

於Android 2.2.2工作室跳轉到1.5.1

+0

你使用真實的設備或模擬器嗎? – savepopulation

+0

在運行項目之前,我使用真實設備:平板電腦三星gt3113和智能手機mi 4c –

+0

,嘗試在設備中手動卸載應用程序並進行全新安裝。 – savepopulation

回答

0

我想你有一個設備作爲我的LG Stylus 3 Android 7.0,在W當你按下應用程序並將應用程序從桌面移動到垃圾箱時,應用程序不會從設備中刪除。詳情請參閱my answer on the same question