gpt4 book ai didi

android - 运行gradle时未找到kotlinx.android.synthetic

转载 作者:行者123 更新时间:2023-12-03 05:45:28 26 4
gpt4 key购买 nike

我正在使用Kotlin Android扩展程序。
我的项目gradle:

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:
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"
...

Gradle 4.6版
Android Studio 3.1.2
版本号AI-173.4720617,建于2018年4月14日
JRE:1.8.0_152-release-1024-b01 x86_64
JVM:JetBrains s.r.o的OpenJDK 64位服务器VM
Mac OS X 10.13.4

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

它曾经可以工作,但我升级的版本之一(Android Studio,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

最佳答案

在Android Studio文件中->使高速缓存无效/重新启动...-> btn“使无效并重新启动”

关于android - 运行gradle时未找到kotlinx.android.synthetic,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50377935/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com