it-swarm.com.de

Gradle konnte das Projekt nicht lösen: linkedin-sdk

Ich benutze Androis Studio 3.0 Canary 4. In meinem Projekt habe ich die Linkedin-SDK, und es funktioniert. Ich kann es gebrauchen Das einzige Problem ist, dass ich diese Nachricht erhalte, wenn ich nach Gradle suche. enter image description here

Und weil ich es nicht erstellen kann, kann ich den Design-Editor und die Vorschau nicht verwenden.

Hier ist mein build.gradle Projekt:

buildscript {
  repositories {
    jcenter()
    maven { url 'https://maven.google.com' }
  }
  dependencies {
    classpath 'com.Android.tools.build:gradle:3.0.0-alpha4'
    classpath 'com.google.gms:google-services:3.0.0'
  }
}

allprojects {
   repositories {
       jcenter()
       maven {
           url 'https://maven.google.com'
       }
   }
}

task clean(type: Delete) {
     delete rootProject.buildDir
}

Build.Gradle-Modul: App

apply plugin: 'com.Android.application'

Android {
    compileSdkVersion 26
    buildToolsVersion "26.0.0"
    defaultConfig {
           applicationId "com.cving_team.cving"
           minSdkVersion 19
           targetSdkVersion 26
           versionCode 1
           versionName "1.0"
           testInstrumentationRunner 
           "Android.support.test.runner.AndroidJUnitRunner"
}
signingConfigs {...}
buildTypes {
    sdkTest {
        signingConfig signingConfigs.sdkTest
        debuggable true

    }
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-Android.txt'), 
        'proguard-rules.pro'
        signingConfig signingConfigs.release
    }
}
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    androidTestCompile('com.Android.support.test.espresso:espresso-
        core:2.2.2', {
        exclude group: 'com.Android.support', module: 'support-annotations'
    })

compile project(':retrofit-2.1.0')
compile project(':linkedin-sdk')
compile 'com.Android.support.constraint:constraint-layout:1.0.2'
compile 'com.Android.support:appcompat-v7:26.0.0-beta2'
compile 'com.Android.support:customtabs:26.0.0-beta2'
compile 'com.Android.support:design:26.0.0-beta2'
compile 'com.Android.support:cardview-v7:26.0.0-beta2'
compile 'com.Android.support:recyclerview-v7:26.0.0-beta2'
compile 'com.facebook.Android:facebook-Android-sdk:4.24.0'
compile 'com.squareup.retrofit2:converter-gson:2.1.0'
compile 'com.squareup.retrofit2:retrofit:2.2.0'
compile 'com.mutualmobile.Android:cardstack:0.5.2'
compile 'com.google.Android.gms:play-services-location:11.0.1'
compile 'com.google.Android.gms:play-services-places:11.0.1'
compile 'com.squareup.okhttp3:okhttp:3.7.0'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.github.bumptech.glide:okhttp3-integration:[email protected]'
compile 'fr.avianey.com.viewpagerindicator:library:[email protected]'
compile 'eu.davidea:flexible-adapter:5.0.0-rc1'
compile 'se.emilsjolander:StickyScrollViewItems:1.1.0'
compile 'com.google.firebase:firebase-core:11.0.1'
compile 'com.google.firebase:firebase-messaging:11.0.1'
testCompile 'junit:junit:4.12'
}

apply plugin: 'com.google.gms.google-services'

Linkedin-sdk ist in settings.gradle auf.

include ':app', ':retrofit-2.1.0', ':fabby-sdk-jni', ':linkedin-sdk'

Woran könnte das liegen?

[~ # ~] Update [~ # ~]

Ich habe diesen Befehl über terminal: gradlew-Tasks gestartet und erhalte den folgenden Fehler:

> Configure project :app
Configuration 'compile' in project ':app' is deprecated. Use 'implementation' instead.
Configuration 'androidTestCompile' in project ':app' is deprecated. Use 'androidTestImplementation' instead.
Configuration 'testCompile' in project ':app' is deprecated. Use 'testImplementation' instead.
registerResGeneratingTask is deprecated, use registerGeneratedFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedFolders(FileCollection)

> Configure project :fabby-sdk-jni
Configuration 'compile' in project ':fabby-sdk-jni' is deprecated. Use 'implementation' instead.
Configuration 'androidTestCompile' in project ':fabby-sdk-jni' is deprecated. Use 'androidTestImplementation' instead.
Configuration 'testCompile' in project ':fabby-sdk-jni' is deprecated. Use 'testImplementation' instead.

> Configure project :linkedin-sdk
Configuration 'compile' in project ':linkedin-sdk' is deprecated. Use 'implementation' instead.
Configuration 'androidTestCompile' in project ':linkedin-sdk' is deprecated. Use 'androidTestImplementation' instead.


FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':app:testSdkTestUnitTest'.
> Could not resolve all task dependencies for configuration ':app:sdkTestUnitTestRuntimeClasspath'.
   > Could not resolve project :linkedin-sdk.
     Required by:
         project :app
      > Unable to find a matching configuration of project :linkedin-sdk:
          - Configuration 'debugApiElements':
              - Required com.Android.build.gradle.internal.dependency.AndroidTypeAttr 'AndroidTypeAttr{name=Aar}' and found compatible value 'AndroidTypeAttr{name=Aar}'.
              - Required com.Android.build.gradle.internal.dependency.BuildTypeAttr 'BuildTypeAttr{name=sdkTest}' and found incompatible value 'BuildTypeAttr{name=debug}'.
              - Found com.Android.build.gradle.internal.dependency.VariantAttr 'VariantAttr{name=debug}' but wasn't required.
              - Required org.gradle.api.attributes.Usage 'for runtime' and found incompatible value 'for compile'.
          - Configuration 'debugRuntimeElements':
              - Required com.Android.build.gradle.internal.dependency.AndroidTypeAttr 'AndroidTypeAttr{name=Aar}' and found compatible value 'AndroidTypeAttr{name=Aar}'.
              - Required com.Android.build.gradle.internal.dependency.BuildTypeAttr 'BuildTypeAttr{name=sdkTest}' and found incompatible value 'BuildTypeAttr{name=debug}'.
              - Found com.Android.build.gradle.internal.dependency.VariantAttr 'VariantAttr{name=debug}' but wasn't required.
              - Required org.gradle.api.attributes.Usage 'for runtime' and found compatible value 'for runtime'.
          - Configuration 'releaseApiElements':
              - Required com.Android.build.gradle.internal.dependency.AndroidTypeAttr 'AndroidTypeAttr{name=Aar}' and found compatible value 'AndroidTypeAttr{name=Aar}'.
              - Required com.Android.build.gradle.internal.dependency.BuildTypeAttr 'BuildTypeAttr{name=sdkTest}' and found incompatible value 'BuildTypeAttr{name=release}'.
              - Found com.Android.build.gradle.internal.dependency.VariantAttr 'VariantAttr{name=release}' but wasn't required.
              - Required org.gradle.api.attributes.Usage 'for runtime' and found incompatible value 'for compile'.
          - Configuration 'releaseRuntimeElements':
              - Required com.Android.build.gradle.internal.dependency.AndroidTypeAttr 'AndroidTypeAttr{name=Aar}' and found compatible value 'AndroidTypeAttr{name=Aar}'.
              - Required com.Android.build.gradle.internal.dependency.BuildTypeAttr 'BuildTypeAttr{name=sdkTest}' and found incompatible value 'BuildTypeAttr{name=release}'.
              - Found com.Android.build.gradle.internal.dependency.VariantAttr 'VariantAttr{name=release}' but wasn't required.
              - Required org.gradle.api.attributes.Usage 'for runtime' and found compatible value 'for runtime'.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

[~ # ~] gelöst [~ # ~]

Nur chenage:

compile project(':linkedin-sdk')

zu

compile project(path: ':linkedin-sdk', configuration: 'default')

31
Fabio Piunti

Ich habe mein Problem gelöst. In build.gradle (Modul-App) muss buildTypes diese Struktur haben:

buildTypes {
    debug {}
    releaseApp {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-Android.txt'), 'proguard-rules.pro'
        signingConfig signingConfigs.release
    }
    releaseSdk {
        signingConfig signingConfigs.sdkTest
        debuggable true
    }
}

und in build.gradle (Module linkedinn-sdk) müssen buildTypes dieselbe Struktur haben. Der neue Code lautet also:

buildTypes {
    debug {}
    releaseApp  {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-Android.txt'), 'proguard-rules.pro'
    }
    releaseSdk {}
}
11
Fabio Piunti

Da Sie das neue Android Plugin 3.x verwenden, müssen Sie die Migrationsrichtlinien befolgen :

Fehler: Fehler beim Auflösen: Projekt konnte nicht aufgelöst werden: linkedin-sdk.

Um diesen Fehler zu beheben, müssen Sie angeben, welcher Build-Typ aus "mylibrary" (in Ihrem Fall linkedin-sdk) das Android-Plugin mit dem Build-Typ "staging" der App übereinstimmen soll. Sie können dies mit der Eigenschaft buildTypeMatching in der Datei build.gradle Der App tun, wie unten gezeigt:

Android {
    ...
    // Tells the Android plugin to use a library's 'debug' build type
    // when a 'staging' build type is not available. You can include
    // additional build types, and the plugin matches 'staging' to the
    // first build type it finds from the one's you specify. That is,
    // if 'mylibrary' doesn't include a 'debug' build type either, the
    // plugin matches 'staging' with the producer's 'release' build type.
    buildTypeMatching 'staging', 'debug', 'release'
}

Bearbeiten : buildTypeMatchingwurde ersetzt durch matchingFallbacks.
Weitere Informationen zum variantensensitiven Abhängigkeitsmanagement finden Sie hier und hier .

Android {
    buildTypes {
        debug {}
        release {}
        staging {
            // Specifies a sorted list of fallback build types that the
            // plugin should try to use when a dependency does not include a
            // "staging" build type. You may specify as many fallbacks as you
            // like, and the plugin selects the first build type that's
            // available in the dependency.
            matchingFallbacks = ['debug', 'qa', 'release']
        }
    }
}

Dann

Es konnte keine passende Projektkonfiguration gefunden werden: linkedin-sdk:

Sie können verwenden

compile project(path: ':linkedin-sdk', configuration: 'default')

sie können jedoch einfach Folgendes verwenden, um die variantenorientierte Abhängigkeitsauflösung zu nutzen. .

implementation project(':linkedin-sdk')

Weitere Informationen zur Konfiguration von 'implementation' Finden Sie im Abschnitt über die neue Abhängigkeit configurations.

20

Ich habe einen ähnlichen Fehler erhalten, den ich beheben konnte:

21:13   Gradle sync failed: Cannot choose between the following configurations of project :sTLivenessLibrary:
        - debugApiElements
        - debugRuntimeElements
        - releaseApiElements
        - releaseRuntimeElements
        All of them match the consumer attributes:
        - Configuration 'debugApiElements':
        - Found com.Android.build.api.attributes.BuildTypeAttr 'debug' but wasn't required.
        - Found com.Android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' but wasn't required.
        - Found com.Android.build.gradle.internal.dependency.VariantAttr 'debug' but wasn't required.
        - Found org.gradle.api.attributes.Usage 'for compile' but wasn't required.
        - Configuration 'debugRuntimeElements':
        - Found com.Android.build.api.attributes.BuildTypeAttr 'debug' but wasn't required.
        - Found com.Android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' but wasn't required.
        - Found com.Android.build.gradle.internal.dependency.VariantAttr 'debug' but wasn't required.

Ich habe dies durch Ändern der Kompilierungskonfiguration behoben:

compile project(':linkedin-sdk')

zu

compile project(path: ':linkedin-sdk', configuration: 'default').
11
autogo

Ja ist es

implementation project(path: ':linkedin-sdk', configuration: 'default') funktioniert

Und Sie können wählen Geschmackstyp in der linken Registerkarte Build Variants

1
Vlad

Ich hatte dieses Problem auch, als ich auf Android studio 3.0) aktualisiert wurde

Dies war mein Build-Typ-Block in der App-Gralde-Datei

 buildTypes {
    staging {
        buildConfigField 'String', 'Host', '"http://compute.amazonaws.com/"'
        buildConfigField 'String', 'REGION_CODE', '"1"'
        debuggable true
        signingConfig signingConfigs.debug
    }
    QA {
        buildConfigField 'String', 'Host', '"com.amazo/"'
        buildConfigField 'String', 'REGION_CODE', '"92"'
        debuggable true
        signingConfig signingConfigs.debug
    }
    notificationTest {
        buildConfigField 'String', 'Host', '"http://a6a"'
        buildConfigField 'String', 'REGION_CODE', '"92"'
        debuggable true
        signingConfig signingConfigs.debug
    }
}

und das waren meine projektabhängigkeiten

compile project(':slideDateTimePicker')
compile project(':scatter')

Ich habe die Dateien scatter build.gradle und slideDateTimePicker build.gradle geöffnet und den Block Android durch diesen ersetzt.

  buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-Android.txt'), 'proguard-rules.pro'
    }
    QA {}
    notificationTest{}
    releaseApp {}
    releaseSdk {}
    staging{}
}
1
Hammad Tariq