Java AndroidStudio:无法解析符号';主要活动&x27;。使用android注释
我决定与Android Studio一起使用,我想通过Gradle实现它。但我遇到了一个错误“无法解析符号'MainActivity'\uuless…验证Android XML文件中的资源引用。” 我的版本: TargetSDK版本22+编译SDK版本22+构建工具版本“22.0.1” 但是当我配置Android Studio(1.4.1)并修改AndroidManifest.XML配置文件时,项目被提示出错。没有我的Java AndroidStudio:无法解析符号';主要活动&x27;。使用android注释,java,android,android-studio,android-gradle-plugin,android-annotations,Java,Android,Android Studio,Android Gradle Plugin,Android Annotations,我决定与Android Studio一起使用,我想通过Gradle实现它。但我遇到了一个错误“无法解析符号'MainActivity'\uuless…验证Android XML文件中的资源引用。” 我的版本: TargetSDK版本22+编译SDK版本22+构建工具版本“22.0.1” 但是当我配置Android Studio(1.4.1)并修改AndroidManifest.XML配置文件时,项目被提示出错。没有我的MainActivity->MainActivity中的预处理类 <?x
MainActivity
->MainActivity
中的预处理类
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.dimon.org.androidannotation" >
<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_" > //here
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
EDIT2
根构建.gradle
apply plugin: 'com.android.application'
apply plugin: 'android-apt'
def AAVersion = '3.3.2'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.dimon.org.androidannotation"
minSdkVersion 19
targetSdkVersion 22
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:22.2.1'
apt "org.androidannotations:androidannotations:$AAVersion"
compile "org.androidannotations:androidannotations-api:$AAVersion"
}
apt {
arguments {
androidManifestFile variant.outputs[0].processResources.manifestFile
resourcePackageName 'com.dimon.org.androidannotation'
}
}
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.4'
// 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
}
我认为这些build.gradle配置没有问题,只是不知道为什么会出错
非常感谢你
在我创建项目后,我的项目没有在
generated/source/apt/debug
目录中生成main活动
文件。为什么
我正在使用以下版本:
- Android Studio 1.4.1
- 渐变版本1.3.0
- 安卓apt 1.4
- AndroidAnnotations版本3.3.2
activity android:name="com.dimon.org.androidannotation.MainActivity_"
更好的方法
MainActivity
- 重建项目
- 清理项目
- 与Gradle文件同步
- 关闭项目、关闭为并重新启动/重新打开
- 文件>使缓存无效/重新启动
MainActivity\uu
或MainActivity
?请提供MainActivity\uuuuu的包名,并确保将活动扩展到此类。您是否首先进行了项目?生成了MainActivity\uuu
文件,因此在第一次成功生成之前它不存在。@IntelliJAmiya实际上生成了MainActivity\uu文件。因此该类名为MainActivity.Bucause Android Studio版本升级,导致某些配置生成的选项消失。直接编译无法生成MainActivity\uu
intelligentlu。@WonderCsabo哦!我终于成功地生成了一个MainActivity文件。因为我的原始订单预编译错误导致无法生成。非常感谢您的帮助。我可以继续学习AndroidAnnotations这个框架。谢谢!!!在我创建项目后,我的项目没有在生成的->源->apt->调试-/code>中生成MainActivity\uuu
文件。为什么?谢谢.file>使缓存无效/重新启动帮助!非常感谢。