首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >运行gradle时找不到kotlinx.android.synthetic

运行gradle时找不到kotlinx.android.synthetic
EN

Stack Overflow用户
提问于 2018-05-16 18:39:39
回答 1查看 2.1K关注 0票数 0

我在使用Kotlin Android扩展。我的项目分级:

代码语言:javascript
复制
buildscript {
    ext.kotlin_version = '1.2.41'
dependencies {
        classpath 'com.android.tools.build:gradle:3.1.2'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
...

我的应用程序gradle:

代码语言:javascript
复制
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'io.fabric'
apply plugin: 'kotlin-kapt'
apply plugin: 'jacoco-android'
apply plugin: "kotlin-allopen"
...

版本4.6AndroidStudio 3.1.2构建#AI-173.4720617,建于2018年4月14日JRE: 1.8.0_152-版本-1024-B01 x86_64 JVM: OpenJDK 64位服务器VM由JetBrains s.r.oMacOSX 10.13.4

当通过IDE运行所有东西时,一切都正常,但是当通过控制台运行时,gradle -p ~/source/android-app assembleDebug突然将任何import kotlinx.android.synthetic.main...标记为未使用,代码中的任何视图都标记为找不到。构建成功

它曾经正常工作,我升级的版本之一(安卓工作室,gradle,Kotlin插件)破坏了它。对下一步该做什么有什么想法吗?

控制台输出:19:46 $ gradle -p ~/source/android-app assembleDebug --console plain WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'. It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection) registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection) registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection) registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection) registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection) :app:preBuild UP-TO-DATE :app:preDebugBuild UP-TO-DATE :app:compileDebugAidl UP-TO-DATE :app:compileDebugRenderscript UP-TO-DATE :app:checkDebugManifest UP-TO-DATE :app:generateDebugBuildConfig :app:mainApkListPersistenceDebug :app:generateDebugResValues UP-TO-DATE :app:generateDebugResources UP-TO-DATE :app:processDebugGoogleServices Parsing json file: /Users/efimerdler-kravitz/source/android-app/app/google-services.json :app:mergeDebugResources UP-TO-DATE :app:createDebugCompatibleScreenManifests :app:processDebugManifest :app:splitsDiscoveryTaskDebug UP-TO-DATE :app:processDebugResources :app:kaptGenerateStubsDebugKotlin :app:kaptDebugKotlin :app:compileDebugKotlin :app:prepareLintJar UP-TO-DATE :app:generateDebugSources :app:javaPreCompileDebug UP-TO-DATE :app:compileDebugJavaWithJavac :app:compileDebugNdk NO-SOURCE :app:compileDebugSources :app:mergeDebugShaders UP-TO-DATE :app:compileDebugShaders UP-TO-DATE :app:generateDebugAssets UP-TO-DATE :app:mergeDebugAssets UP-TO-DATE :app:transformClassesWithDexBuilderForDebug :app:transformDexArchiveWithExternalLibsDexMergerForDebug :app:transformDexArchiveWithDexMergerForDebug :app:mergeDebugJniLibFolders UP-TO-DATE :app:transformNativeLibsWithMergeJniLibsForDebug UP-TO-DATE :app:processDebugJavaRes NO-SOURCE :app:transformResourcesWithMergeJavaResForDebug UP-TO-DATE :app:validateSigningDebug UP-TO-DATE :app:packageDebug :app:assembleDebug

EN

回答 1

Stack Overflow用户

发布于 2018-05-28 21:52:33

在Android文件中,->使缓存失效/重新启动。-> btn“失效并重新启动”

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/50377935

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档