迁移到android gradle插件“3.0.0-beta7”后,我添加了我的应用程序模块。由于3.0.0 buildTypes在MAIN MODULE和dependency MODULE中应该相同。我做了dat,但我仍然遇到这些错误:
"Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve project :library"
对所有变体重复此错误:debug,tst和release。我已经阅读了整个migrate to 3.0 tutorial by android。还尝试添加matchingFallbacks
,即使buildTypes完全相同但仍然接收这些错误。似乎插件中有一个错误或者什么......
build.gradle app module:
signingConfigs {
tstRelease {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile file(keystoreProperties['storeFile'])
storePassword keystoreProperties['storePassword']
}
}
buildTypes {
debug {
matchingFallbacks 'debug'
applicationIdSuffix ".debug"
testCoverageEnabled !project.hasProperty('android.injected.invoked.from.ide')
renderscriptDebuggable true
}
tst {
debuggable true
signingConfig signingConfigs.tstRelease
}
release {
debuggable false
minifyEnabled true
//TODO: add more proguard configs here for different libs
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.tstRelease
}
flavorDimensions "default"
}
dataBinding {
enabled = true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
sourceSets {
androidTest.java.srcDirs += "src/test-common/java"
test.java.srcDirs += "src/test-common/java"
}
lintOptions {
lintConfig rootProject.file('lint.xml')
}
}
我如何调用我的`library:
implementation project(path: ":library" )
build.gradle:library module:
`
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildTypes {
debug {
}
tst {
}
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.prodConfig
buildConfigField "String", "BASE_URL", ""
}
}
play {
jsonFile = file(serviceAccountName)
track = 'alpha'
}
flatc {
genMutable = true
}
:库模块 - 依赖项 /// FCM;崩溃报告;通知;远程配置 依赖性{
implementation "com.google.dagger:dagger:${rootProject.ext.daggerVersion}"
annotationProcessor "com.google.dagger:dagger-compiler:${rootProject.ext.daggerVersion}"
implementation "com.jakewharton.timber:timber:${rootProject.ext.timberVersion}"
implementation "com.google.android.agera:agera:${rootProject.ext.ageraVersion}"
implementation "com.google.android.agera:content:${rootProject.ext.ageraVersion}"
implementation "com.google.android.agera:database:${rootProject.ext.ageraVersion}"
implementation "com.google.android.agera:net:${rootProject.ext.ageraVersion}"
implementation "com.google.android.agera:rvadapter:${rootProject.ext.ageraVersion}"
implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
implementation "com.android.support:cardview-v7:${rootProject.ext.supportLibVersion}"
implementation "com.android.support:support-v4:${rootProject.ext.supportLibVersion}"
implementation "com.android.support:design:${rootProject.ext.supportLibVersion}"
implementation "com.android.support:percent:${rootProject.ext.supportLibVersion}"
implementation "com.android.support:preference-v14:${rootProject.ext.supportLibVersion}"
implementation "com.google.code.gson:gson:${rootProject.ext.gsonVersion}"
implementation "com.squareup.okhttp3:okhttp:${rootProject.ext.okHttpVersion}"
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
api project(":androidtestlib")
implementation "com.google.firebase:firebase-core:${rootProject.ext.firebaseVersion}"
implementation "com.google.firebase:firebase-messaging:${rootProject.ext.firebaseVersion}"
implementation "com.google.firebase:firebase-config:${rootProject.ext.firebaseVersion}"
implementation "com.google.firebase:firebase-crash:${rootProject.ext.firebaseVersion}"
implementation "com.google.firebase:firebase-perf:${rootProject.ext.firebaseVersion}"
implementation "com.firebase:firebase-jobdispatcher:${rootProject.ext.jobDispatcherVersion}"
testCompile 'junit:junit:4.12'
testCompile 'org.mockito:mockito-core:2.8.47'
androidTestCompile 'org.mockito:mockito-android:2.8.47'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.newrelic.agent.android:android-agent:5.12.3'
}
申请插件:'com.google.gms.google-services'
编辑:
添加
api project(path: ":library", configuration: 'default' )
或
implementation project(path: ":library", configuration: 'default' )
项目编译的结果,但在尝试使用模块类时,会出现以下弹出窗口。
在这里,我可以选择向项目添加依赖项。这导致Android studio添加依赖关系< 3 android gradle插件方式。这给了我与问题顶部相同的错误。