gpt4 book ai didi

Android Studio 找不到我导入的任何本地模块

转载 作者:行者123 更新时间:2023-12-03 04:19:58 26 4
gpt4 key购买 nike

Android Studio 将成功导入本地模块(Android 项目模块),但实际上不会找到它们。如果我将同一个模块更改为只是一个 java 库,那么它将正常工作并找到这些依赖项。我真的不知道为什么。该应用程序成功编译并尝试包含给定模块,但是当我尝试从导入的模块中引用一个类时,它找不到它。 ./gradlew app:dependencies 认为它​​正在导入它,但仍然找不到它。 AFAIK 这是我在其他各种项目中使用的完全相同的设置,但我没有看到任何差异。

用于任务的 build.gradle

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'io.objectbox'


android {
compileSdkVersion 27

defaultConfig {
applicationId "io.danielhartman.tasks"
minSdkVersion 21
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'
}
}

}

dependencies {
implementation Libs.support_annotations
implementation Libs.support_appcompat_v7
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'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation Libs.room_imp
kapt Libs.room_annotation_processor
implementation project(path: ':common', configuration:'default')
implementation Libs.recyclerview
implementation Libs.livedata
}
repositories {
mavenCentral()
}

应用程序的 build.gradle
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'

android {
compileSdkVersion 27
defaultConfig {
applicationId "io.danielhartman.lyfe"
minSdkVersion 21
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'
}
}
}

dependencies {
implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation"com.android.support:cardview-v7:27.1.1"
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
implementation 'com.android.support:support-vector-drawable:27.1.1'
implementation project(path: ':tasks', configuration:'default')
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'
implementation project(path: ':tasks', configuration: 'default')
}
repositories {
mavenCentral()
}

最佳答案

我意识到我在使用apply plugin: 'com.android.application'而不是 apply plugin: 'com.android.library' .

关于Android Studio 找不到我导入的任何本地模块,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51529591/

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