我导入了项目' forecastie-master-master'从GitHub到我自己的项目。我按照导入项目的步骤进行操作。请帮我解决这个错误,我是进口项目的新手。
我自己的项目的gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.example.bumbleshet.tourpinas3"
minSdkVersion 21
targetSdkVersion 23
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
buildToolsVersion '26.0.2'
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:cardview-v7:26.1.0'
// implementation 'com.android.support:design:26.0.0'
//implementation 'com.android.support:design:26.0.0'
//imlementation 'com.android.support:support-v4:26.0.0'
implementation 'com.android.support:design:26.1.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
//implementatoin 'com.android.support.constraint:constraint-layout:1.0.2'
// implementation 'com.google.android.gms.play-servies:11.8.0'
implementation 'com.lapism:searchview:4.0'
implementation 'com.google.firebase:firebase-core:11.8.0'
implementation 'com.google.firebase:firebase-database:11.8.0'
implementation 'com.google.firebase:firebase-auth:11.8.0'
implementation 'com.google.android.gms:play-services-maps:11.8.0'
implementation 'com.google.android.gms:play-services-location:11.8.0'
implementation 'com.google.android.gms:play-services-places:11.8.0'
//implementation project (':app2')//{
// exclude group: 'com.android.support', module:'library'
//}
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
implementation project(':app2')
}
apply plugin: 'com.google.gms.google-services'
my imported project's gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "cz.martykan.forecastie"
minSdkVersion 21
targetSdkVersion 23
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
lintOptions {
checkReleaseBuilds true
abortOnError false
xmlReport true
htmlReport true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
buildToolsVersion '26.0.2'
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
implementation 'com.google.android.apps.dashclock:dashclock-api:+'
implementation 'com.roughike:bottom-bar:1.4.0.1'
implementation 'com.diogobernardino:williamchart:2.2'
}
settings.gradle:
include ':app2',':app'
错误:
Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve project :app2. <a href="openFile:C:../build.gradle">Open File</a><br><a href="Unable to resolve dependency for ":app@debug/compileClasspath": Could not resolve project :app2.">
Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not resolve project :app2. <a href="openFile:C:../build.gradle">Open File</a><br><a href="Unable to resolve dependency for ":app@debug/compileClasspath": Could not resolve project :app2.">
Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not resolve project :app2. <a href="openFile:C:../build.gradle">Open File</a><br><a href="Unable to resolve dependency for ":app@debug/compileClasspath": Could not resolve project :app2.">
Unable to resolve dependency for ':app@release/compileClasspath': Could not resolve project :app2. <a href="openFile:C:../build.gradle">Open File</a><br><a href="Unable to resolve dependency for ":app@debug/compileClasspath": Could not resolve project :app2.">
Unable to resolve dependency for ':app@releaseUnitTest/compileClasspath': Could not resolve project :app2. <a href="openFile:C:../build.gradle">Open File</a><br><a href="Unable to resolve dependency for ":app@debug/compileClasspath": Could not resolve project :app2.">
细节:
Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not resolve project :app2. Could not resolve project :app2.
要求:project:app
无法找到项目的匹配配置:app2: - 配置&#39; debugApiElements&#39;: - 必需的com.android.build.api.attributes.BuildTypeAttr&#39; debug&#39;并找到兼容的值&#39; debug&#39;。 - 必需的com.android.build.gradle.internal.dependency.AndroidTypeAttr&#39; Aar&#39;并发现不相容的价值&#39; Apk&#39; - 找到com.android.build.gradle.internal.dependency.VariantAttr&#39; debug&#39;但并不是必需的。 - 必需的org.gradle.api.attributes.Usage&#39; java-api&#39;并找到兼容的价值&#39; java-api&#39;。 - 配置&#39; debugMetadataElements&#39;: - 必需的com.android.build.api.attributes.BuildTypeAttr&#39; debug&#39;并找到兼容的值&#39; debug&#39;。 - 必需的com.android.build.gradle.internal.dependency.AndroidTypeAttr&#39; Aar&#39;并发现不兼容的价值元数据&#39;。 - 找到com.android.build.gradle.internal.dependency.VariantAttr&#39; debug&#39;但并不是必需的。 - 必需的org.gradle.api.attributes.Usage&#39; java-api&#39;但没有提供任何价值。 - 配置&#39; debugRuntimeElements&#39;: - 必需的com.android.build.api.attributes.BuildTypeAttr&#39; debug&#39;并找到兼容的值&#39; debug&#39;。 - 必需的com.android.build.gradle.internal.dependency.AndroidTypeAttr&#39; Aar&#39;并发现不相容的价值&#39; Apk&#39; - 找到com.android.build.gradle.internal.dependency.VariantAttr&#39; debug&#39;但并不是必需的。 - 必需的org.gradle.api.attributes.Usage&#39; java-api&#39;并发现了不兼容的价值&#39; java-runtime&#39;。 - 配置&profileApiElements&#39;: - 必需的com.android.build.api.attributes.BuildTypeAttr&#39; debug&#39;并发现不兼容的价值&#39; profile&#39;。 - 必需的com.android.build.gradle.internal.dependency.AndroidTypeAttr&#39; Aar&#39;并发现不相容的价值&#39; Apk&#39; - 找到com.android.build.gradle.internal.dependency.VariantAttr&#39; profile&#39;但并不是必需的。 - 必需的org.gradle.api.attributes.Usage&#39; java-api&#39;并找到兼容的价值&#39; java-api&#39;。 - 配置&#39; profileMetadataElements&#39;: - 必需的com.android.build.api.attributes.BuildTypeAttr&#39; debug&#39;并发现不兼容的价值&#39; profile&#39;。 - 必需的com.android.build.gradle.internal.dependency.AndroidTypeAttr&#39; Aar&#39;并发现不兼容的价值元数据&#39;。 - 找到com.android.build.gradle.internal.dependency.VariantAttr&#39; profile&#39;但并不是必需的。 - 必需的org.gradle.api.attributes.Usage&#39; java-api&#39;但没有提供任何价值。 - 配置&#39; profileRuntimeElements&#39;: - 必需的com.android.build.api.attributes.BuildTypeAttr&#39; debug&#39;并发现不兼容的价值&#39; profile&#39;。 - 必需的com.android.build.gradle.internal.dependency.AndroidTypeAttr&#39; Aar&#39;并发现不相容的价值&#39; Apk&#39; - 找到com.android.build.gradle.internal.dependency.VariantAttr&#39; profile&#39;但并不是必需的。 - 必需的org.gradle.api.attributes.Usage&#39; java-api&#39;并发现了不兼容的价值&#39; java-runtime&#39;。 - 配置&release; ApiElements&#39;: - 必需的com.android.build.api.attributes.BuildTypeAttr&#39; debug&#39;并发现不兼容的价值&#39;发布&#39; - 必需的com.android.build.gradle.internal.dependency.AndroidTypeAttr&#39; Aar&#39;并发现不相容的价值&#39; Apk&#39; - 找到com.android.build.gradle.internal.dependency.VariantAttr&#39;发布&#39;但并不是必需的。 - 必需的org.gradle.api.attributes.Usage&#39; java-api&#39;并找到兼容的价值&#39; java-api&#39;。 - 配置&#39; releaseMetadataElements&#39;: - 必需的com.android.build.api.attributes.BuildTypeAttr&#39; debug&#39;并发现不兼容的价值&#39;发布&#39; - 必需的com.android.build.gradle.internal.dependency.AndroidTypeAttr&#39; Aar&#39;并发现不兼容的价值元数据&#39;。 - 找到com.android.build.gradle.internal.dependency.VariantAttr&#39;发布&#39;但并不是必需的。 - 必需的org.gradle.api.attributes.Usage&#39; java-api&#39;但没有提供任何价值。 - 配置'releaseRuntimeElements&#39;: - 必需的com.android.build.api.attributes.BuildTypeAttr&#39; debug&#39;并发现不兼容的价值&#39;发布&#39; - 必需的com.android.build.gradle.internal.dependency.AndroidTypeAttr&#39; Aar&#39;并发现不相容的价值&#39; Apk&#39; - 找到com.android.build.gradle.internal.dependency.VariantAttr&#39;发布&#39;但并不是必需的。 - 必需的org.gradle.api.attributes.Usage&#39; java-api&#39;并发现了不兼容的价值&#39; java-runtime&#39;。
答案 0 :(得分:0)
您无法导入&#39; Apk&#39;作为应用程序的模块。它需要是一个&#39; Aar&#39;
错误:
Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and found incompatible value 'Apk'
通常意味着您需要从
更改模块的build.gradleapply plugin: 'com.android.application'
到
apply plugin: 'com.android.library'