通过下面的代码示例解决该问题。
在Android Studio中打开一个已下载的项目时,有时会看到两个项目文件夹,一个包含代码和资源,另一个则是一个文件夹。如果你想删除这个不必要的文件夹,可以按以下步骤操作。
首先打开你的project结构: File--> Project Structure
选择Modules
标记选中你的module,然后单击右侧的“Open Module Settings”(打开模块设置)。
在左侧的栏目中,选择“Sources”(来源)
在其中选择“Path”(路径)中的蓝色链接,它会将您带到根目录。
您应该看到两个文件夹,其中一个是您的代码和资源文件夹(通常为app),而另一个则是文件夹。
在文件夹上单击右键,选择“Delete”(删除)。
代码示例如下:
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:30.0.0'
implementation 'com.android.support.constraint:constraint-layout:2.0.2'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}