Android批注和applicationIdSuffix [英] Android annotations and applicationIdSuffix

查看:416
本文介绍了Android批注和applicationIdSuffix的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近我一直在尝试 Android注释,并且一切运行良好,直到我决定在<我的build.gradle文件中的c1>.当前看起来像这样:

I'd been trying out Android annotations recently and everything had been working well until I decided to add applicationIdSuffix in buildTypes in my build.gradle file. Currently it looks like this:

buildTypes {
    debug {
        applicationIdSuffix '.debug'
    }

    ...
}

编译后,我在gradle控制台中获得以下登录信息:

And upon compiling I get the following log in gradle console:

:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild生成日期
:app:pre_testBuild UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72220Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42220Library UP-TO-DATE
:app:prepareDebugDependencies
:app:compileDebugAidl更新日期
:app:compileDebugRenderscript截止日期
:app:generateDebugBuildConfig截止日期
:app:generateDebugAssets更新日期
:app:mergeDebugAssets更新日期
:app:generateDebugResValues截止日期
:app:processDebugGoogleServices
找不到与程序包名称"org.me.myapp.debug"匹配的客户端.
:app:generateDebugResources
:app:mergeDebugResources截止日期
:app:processDebugManifest截止日期
:app:processDebugResources截止日期
:app:generateDebugSources更新日期
:app:processDebugJavaRes截止日期
:app:compileDebugJavaWithJavac
注意:将日志文件解析到/dir/myapp/app/build/generated/source/apt/androidannotations.log
注意:使用选项{androidManifestFile =/dir/myapp/app/build/intermediates/manifests/full/debug/AndroidManifest.xml}初始化AndroidAnnotations 3.3.1.
注意:开始处理18个元素上的4个注释
注意:找到具有指定路径的AndroidManifest.xml文件:/dir/myapp/app/build/intermediates/manifests/full/debug/AndroidManifest.xml 注意:找到的AndroidManifest.xml:AndroidManifest [applicationPackage = org.me.myapp.debug,componentQualifiedNames = [org.me.myapp.ui.MainActivity_,net.hockeyapp.android.UpdateActivity],PermissionQualifiedNames = [android.permission.ACCESS_WIFI_STATE, android.permission.ACCESS_NETWORK_STATE],applicationClassName = null,libraryProject = false,debugabble = false,minSdkVersion = 15,maxSdkVersion = -1,targetSdkVersion = 22]
错误:找不到生成的org.me.myapp.debug.R类
注意:找到的Android类:android.R
注意:时间测量:[整个处理= 15毫秒],[提取清单= 4毫秒],[提取注释= 3毫秒],
注意:完成处理
注意:开始处理0个元素上的0个注释
注意:时间测量:[整个处理= 0毫秒],
注意:完成处理
1个错误
失败
失败:构建失败,并出现异常.
*出了什么问题:
任务':app:compileDebugJavaWithJavac'的执行失败.

:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:pre_testBuild UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72220Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42220Library UP-TO-DATE
:app:prepareDebugDependencies
:app:compileDebugAidl UP-TO-DATE
:app:compileDebugRenderscript UP-TO-DATE
:app:generateDebugBuildConfig UP-TO-DATE
:app:generateDebugAssets UP-TO-DATE
:app:mergeDebugAssets UP-TO-DATE
:app:generateDebugResValues UP-TO-DATE
:app:processDebugGoogleServices
No matching client found for package name 'org.me.myapp.debug'
:app:generateDebugResources
:app:mergeDebugResources UP-TO-DATE
:app:processDebugManifest UP-TO-DATE
:app:processDebugResources UP-TO-DATE
:app:generateDebugSources UP-TO-DATE
:app:processDebugJavaRes UP-TO-DATE
:app:compileDebugJavaWithJavac
Note: Resolve log file to /dir/myapp/app/build/generated/source/apt/androidannotations.log
Note: Initialize AndroidAnnotations 3.3.1 with options {androidManifestFile=/dir/myapp/app/build/intermediates/manifests/full/debug/AndroidManifest.xml}
Note: Start processing for 4 annotations on 18 elements
Note: AndroidManifest.xml file found with specified path: /dir/myapp/app/build/intermediates/manifests/full/debug/AndroidManifest.xml Note: AndroidManifest.xml found: AndroidManifest [applicationPackage=org.me.myapp.debug, componentQualifiedNames=[org.me.myapp.ui.MainActivity_, net.hockeyapp.android.UpdateActivity], permissionQualifiedNames=[android.permission.ACCESS_WIFI_STATE, android.permission.ACCESS_NETWORK_STATE], applicationClassName=null, libraryProject=false, debugabble=false, minSdkVersion=15, maxSdkVersion=-1, targetSdkVersion=22]
error: The generated org.me.myapp.debug.R class cannot be found
Note: Found Android class: android.R
Note: Time measurements: [Whole Processing = 15 ms], [Extract Manifest = 4 ms], [Extract Annotations = 3 ms],
Note: Finish processing
Note: Start processing for 0 annotations on 0 elements
Note: Time measurements: [Whole Processing = 0 ms],
Note: Finish processing
1 error
FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.

我尝试再次清理和重建,从项目中删除了generated目录,但没有任何帮助.如果我从build.gradle文件中删除applicationIdsuffix,则一切正常.我该如何解决这个问题?

I've tried cleaning and rebuilding again, removing generated directory from the project, but nothing helps. If I remove applicationIdsuffix from build.gradle file, everything works fine. How can I fix this problem?

推荐答案

从您的build.gradle文件中删除以下行:

Remove this line from your build.gradle file:

resourcePackageName android.variant.applicationId

编辑:尝试将此行添加到您的apt块中:

Edit: try to add this line to your apt block:

resourcePackageName "org.me.myapp"

这篇关于Android批注和applicationIdSuffix的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆