在标记为重复的问题之前,请先完整阅读。谢谢
我的Android Studio出现问题。在测试我的应用程序时,出现错误(编码错误),并且尝试再次运行应用程序后,出现错误Default activity not found
。
之后,我搜索了有关该错误的答案,但两个小时后,我放弃了,尝试了所有发现的问题:检查manifestxml文件,无效并重新启动选项,同步gradle文件,没有任何结果。因此,我决定制作一个新项目,并将该项目中的所有内容复制到新项目中,但首先要确保它可以像现在这样正常工作,一个全新的项目,令人惊讶的是没有,没有运行,并且错误一样。请帮帮我。
AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="gabriel.android">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
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>
build.gradle模块应用
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "gabriel.android"
minSdkVersion 23
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
build.gradle项目顶级文件
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}