Java Android Studio棉花糖问题(活动类不存在)
我在安卓工作室开始了一个项目,安卓版本最低为6.0。 我做了一些工作,然后想在我的设备上试用。 当我开始运行时,它显示了以下错误:Java Android Studio棉花糖问题(活动类不存在),java,android,android-intent,android-studio,android-6.0-marshmallow,Java,Android,Android Intent,Android Studio,Android 6.0 Marshmallow,我在安卓工作室开始了一个项目,安卓版本最低为6.0。 我做了一些工作,然后想在我的设备上试用。 当我开始运行时,它显示了以下错误: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.example.------.------/.Test } Error type 3 Error: Activity class {com.example.-----.---
Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.example.------.------/.Test }
Error type 3
Error: Activity class {com.example.-----.------/com.example.-----.-----.Test} does not exist.
然后我试着在同一台设备上运行另一个项目,但我得到了同样的错误
我还在另一台运行安卓5.1.1的设备上尝试了另一个项目,效果非常好
之后,我认为这可能来自我的代码,它可能与棉花糖不兼容,所以我所做的是:
创建一个最低版本为6.0的全新项目,设置一个空白活动,在手机上运行时不触摸任何东西,我也遇到了同样的问题
我正在使用:
摩托罗拉Moto X 2014,配备CM13,
Android Studio 1.4.1,
Galaxy S3作为运行5.1.1的设备,
和ubuntu 15.10
我已经尝试了很多修复方法,但都不起作用。
我希望你能帮我找到解决办法,
谢谢你的帮助:)
[编辑]
这是我的舱单:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.------.------" >
<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(模块:应用程序)
格雷德尔(项目:-----------)
您可以在关闭即时跑步功能的情况下尝试。
这会奏效的即时运行是一项功能,用于仅热交换计算机中当前会话中可用的生成的已更改文件。是否使用生成工具1.5.0-beta?在我的例子中,这导致了编译错误。使用1.3.0修复了它。我已经在使用构建工具1.3.0:/我会尝试使用与com.example不同的东西。我不希望这会改变任何东西,但请尝试一下。我已使用不同的包名创建了一个新项目,但仍然出现相同的错误:/
package com.example.-----.--------;
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);
}
}
apply plugin: 'com.android.application'
android
{
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig
{
applicationId "com.example.------.-----------"
minSdkVersion 23
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes
{
release
{
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies
{
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
}
buildscript
{
repositories
{
jcenter()
}
dependencies
{
classpath 'com.android.tools.build:gradle:1.3.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects
{
repositories
{
jcenter()
}
}
task clean(type: Delete)
{
delete rootProject.buildDir
}