gpt4 book ai didi

android - 尝试将 Gradle 项目导入 Android Studio 现有项目时出错

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

我正在尝试将我在所有带有实用程序的应用程序中使用的 3 个 Gradle 项目导入一个新项目。

我创建新项目,然后文件 -> 项目结构 -> + -> 导入 Gradle 项目 Projects selected to be imported

然后我点击完成,但是这 3 个项目没有出现在模块列表中

Modules list, without the 3 projects that should have been imported

还没有出现错误。但是当我点击确定时,我确实遇到了 4 个 IDE fatal error :

1/4

Element: class org.jetbrains.plugins.groovy.lang.psi.impl.GroovyFileImpl because: different providers: SingleRootFileViewProvider{myVirtualFile=file://F:/development/workspaces/Orchestram/settings.gradle, content=VirtualFileContent{size=16}}(2177d6ca); SingleRootFileViewProvider{myVirtualFile=file://F:/development/workspaces/Orchestram/settings.gradle, content=VirtualFileContent{size=16}}(16a77aa0)

2/4
Element: class com.intellij.psi.impl.compiled.ClsFileImpl because: file://F:/development/workspaces/Orchestram/app/callRemoteService/build/intermediates/classes/debug/com/qbitera/CallRemoteService/R.class is invalid

3/4
Element: class org.jetbrains.plugins.groovy.lang.psi.impl.GroovyFileImpl because: different providers: SingleRootFileViewProvider{myVirtualFile=file://F:/development/workspaces/Orchestram/settings.gradle, content=VirtualFileContent{size=16}}(344f03e4); SingleRootFileViewProvider{myVirtualFile=file://F:/development/workspaces/Orchestram/settings.gradle, content=VirtualFileContent{size=16}}(4940c49e)

4/4
Error while applying changes

这是我在尝试导入这些模块之前的 build.gradle(它不会改变)
apply plugin: 'com.android.application'

android {
compileSdkVersion 27
defaultConfig {
applicationId "com.qbitera.cerqana.orchestram"
minSdkVersion 14
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
buildToolsVersion '27.0.3'
}

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}

和 settings.gradle
include ':app'

当然,如果我尝试只在 Gradle 中包含 implementation project(':callRemoteService') 行,它就会失败。但是如果尝试从项目结构中再次导入模块,它表示它已经在项目中

enter image description here

最佳答案

添加到根文件夹的settings.gradle:

include ':app'
include ':your_module'
include ':your_second_module'
include ':you_got_the_point'

关于android - 尝试将 Gradle 项目导入 Android Studio 现有项目时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50170838/

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