簡體   English   中英

無法在AVD中啟動應用

[英]Can't launch app in AVD

我是一個新的android程序員。
我在android studio中創建了一個簡單的“ Hello World”應用程序,但是當我在AVD上運行它時,出現以下錯誤:

Unexpected error while executing: am start -n "com.example.ahrims.helloworld/com.example.ahrims.helloworld.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Error while Launching activity  

編輯1:
這是清單文件:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.ahrims.helloworld">

<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"
        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>  

編輯2:
以下是MainActivity文件:

package com.example.ahrims.helloworld;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;

public class MainActivity extends AppCompatActivity {

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

我用谷歌搜索,但沒有找到任何有用的答案。
任何幫助,將不勝感激。 提前致謝。

刪除.idea文件夾和gradle文件夾,然后單擊“與gradle同步項目” gradle文件,此過程完成后,您可以運行您的應用

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM