当前位置: 首页 > 知识库问答 >
问题:

错误: 无法解决:

鞠嘉誉
2023-03-14

现在我正在尝试从git运行克隆应用程序https://github.com/frinder/frinder-app但问题是该应用程序制作了很长时间,所以应该改变bulid.gradle

但是当我尝试相同的同步实现“com.android.支持:动画矢量可绘制:28.0.0”,但如果我删除它,请继续向我显示错误28.0.0它显示如下

All com.android.support libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 28.0.0, 27.0.2. Examples include com.android.support:animated-vector-drawable:28.0.0 and com.android.support:support-media-compat:27.0.2 more...

但我不知道是什么造成了不完全相同的版本

这是应用程序build.gradle(模块)

buildscript {
    repositories {
        maven { url 'https://maven.fabric.io/public' }
    }

    dependencies {
        // These docs use an open ended version so that our plugin
        // can be updated quickly in response to Android tooling updates

        // We recommend changing it to the latest version from our changelog:
        // https://docs.fabric.io/android/changelog.html#fabric-gradle-plugin
        classpath 'io.fabric.tools:gradle:1.28.0'
    }
}

apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

repositories {
    maven { url 'https://maven.fabric.io/public' }
    maven { url "https://maven.google.com/" }
    mavenCentral()
}

ext {
    supportLibVersion = '28.0.3'  // variable that can be referenced to keep support libs consistent
}

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.frinder.frinder"
        minSdkVersion 21
        targetSdkVersion 28
        multiDexEnabled true
        vectorDrawables.useSupportLibrary = true
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }

    lintOptions {
        abortOnError false
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }

        dev {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

// Based on https://stackoverflow.com/questions/34251441/commiting-google-services-json-to-github
def build_param = "${build}";
if (build_param != "dev") {
    //exclude production build
    android.variantFilter { variant ->
        if (variant.buildType.name.equals('dev')) {
            variant.setIgnore(true);
        }
    }
} else {
    //exclude all except production build
    android.variantFilter { variant ->
        if (!variant.buildType.name.equals('dev')) {
            variant.setIgnore(true)
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    implementation('com.crashlytics.sdk.android:crashlytics:2.6.8@aar') {
        transitive = true
    }

    implementation "com.android.support:animated-vector-drawable:28.0.0"
    implementation "com.android.support:appcompat-v7:28.0.0"
    implementation "com.android.support:cardview-v7:28.0.0"
    implementation "com.android.support:customtabs:28.0.0"
    implementation "com.android.support:design:28.0.0"
    implementation "com.android.support:recyclerview-v7:28.0.0"
    implementation 'com.android.support.constraint:constraint-layout:28.0.0'
    implementation 'com.google.firebase:firebase-core:17.0.0'
    implementation 'com.facebook.android:facebook-login:4.42.0'
    implementation 'com.facebook.android:facebook-places:4.42.0'
    implementation 'com.github.bumptech.glide:glide:4.9.0'
    implementation 'com.google.firebase:firebase-firestore:20.1.0'
    implementation 'com.google.firebase:firebase-database:18.0.0'
    implementation 'com.firebase:geofire-android:2.1.2'
    implementation 'com.google.code.gson:gson:2.8.5'
    implementation 'com.google.android.gms:play-services-location:17.0.0'
    implementation 'com.jakewharton:butterknife:8.8.1'
    implementation 'org.parceler:parceler-api:1.1.6'
    implementation 'de.hdodenhof:circleimageview:3.0.0'
    implementation 'org.apmem.tools:layouts:1.10@aar'
    implementation 'com.github.stfalcon:chatkit:0.2.2'
    testImplementation 'junit:junit:4.12'
    annotationProcessor 'com.jakewharton:butterknife-compiler:8.4.0'
    annotationProcessor 'org.parceler:parceler:1.1.6'
    implementation 'com.skyfishjy.ripplebackground:library:1.0.1'
    implementation 'jp.wasabeef:recyclerview-animators:2.2.7'
}
apply plugin: 'com.google.gms.google-services'


这是应用程序builder . grad le(项目)

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
        google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.4.1'
        classpath 'com.google.gms:google-services:4.2.0'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
        maven {
            url "https://maven.google.com" // Google's Maven repository
        }
    }
}

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

清单文件在这里

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="com.frinder.frinder">

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />

    <application
        tools:replace="android:appComponentFactory"
        android:appComponentFactory="whateverString"
        android:allowBackup="true"
        android:icon="@drawable/ic_icon"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity
            android:name=".activity.MainActivity"
            android:theme="@style/SplashTheme">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <meta-data
            android:name="io.fabric.ApiKey"
            android:value="18312e191b37bec3700f47ecf214e9c79a589efb" />
        <meta-data
            android:name="com.facebook.sdk.ApplicationId"
            android:value="@string/facebook_app_id" />

        <activity
            android:name="com.facebook.FacebookActivity"
            android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
            android:label="@string/app_name" />
        <activity
            android:name="com.facebook.CustomTabActivity"
            android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />

                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />

                <data android:scheme="@string/fb_login_protocol_scheme" />
            </intent-filter>
        </activity>
        <activity android:name=".activity.LoginActivity"
            android:theme="@style/Theme.AppCompat.NoActionBar" />
        <activity android:name=".activity.DiscoverActivity" />
        <activity android:name=".activity.NotificationsActivity" />
        <activity android:name=".activity.EditProfileActivity" />
        <activity android:name=".activity.MessagesListActivity" />
        <activity android:name=".activity.MessageDetailActivity" />
    </application>

</manifest>

错误logcat

ERROR: Failed to resolve: com.android.support.constraint:constraint-layout:28.0.0
Show in Project Structure dialog
Affected Modules: app

它使同步失败

我想解决这个问题。。。

新错误 当我运行时

Executing tasks: [:app:assembleDebug]


> Configure project :app
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)

> Task :app:buildInfoDebugLoader
> Task :app:preBuild UP-TO-DATE
> Task :app:preDebugBuild UP-TO-DATE
> Task :app:compileDebugAidl NO-SOURCE
> Task :app:compileDebugRenderscript NO-SOURCE
> Task :app:checkDebugManifest UP-TO-DATE
> Task :app:generateDebugBuildConfig UP-TO-DATE
> Task :app:mergeDebugShaders UP-TO-DATE
> Task :app:compileDebugShaders UP-TO-DATE
> Task :app:generateDebugAssets UP-TO-DATE
> Task :app:mergeDebugAssets UP-TO-DATE
> Task :app:writeDebugApplicationId UP-TO-DATE

> Task :app:processDebugGoogleServices
Parsing json file: C:\Users\bon300-36\AndroidStudioProjects\frinder-app\app\src\debug\google-services.json

> Task :app:createDebugCompatibleScreenManifests UP-TO-DATE
> Task :app:mainApkListPersistenceDebug UP-TO-DATE
> Task :app:processDebugManifest
> Task :app:fabricGenerateResourcesDebug UP-TO-DATE
> Task :app:prepareLintJar UP-TO-DATE
> Task :app:generateDebugSources
> Task :app:javaPreCompileDebug
> Task :app:generateDebugResValues UP-TO-DATE
> Task :app:generateDebugResources UP-TO-DATE
> Task :app:mergeDebugResources
warn: removing resource com.frinder.frinder:string/com_facebook_loginview_logged_in_using_facebook_f1gender without required default value.

> Task :app:processDebugResources

> Task :app:compileDebugJavaWithJavac
Gradle may disable incremental compilation as the following annotation processors are not incremental: butterknife-compiler-8.4.0.jar (com.jakewharton:butterknife-compiler:8.4.0), parceler-1.1.6.jar (org.parceler:parceler:1.1.6), auto-service-1.0-rc2.jar (com.google.auto.service:auto-service:1.0-rc2).
Consider setting the experimental feature flag android.enableSeparateAnnotationProcessing=true in the gradle.properties file to run annotation processing in a separate task and make compilation incremental.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.

> Task :app:instantRunMainApkResourcesDebug
> Task :app:validateSigningDebug UP-TO-DATE
> Task :app:signingConfigWriterDebug UP-TO-DATE
> Task :app:processInstantRunDebugResourcesApk
> Task :app:checkDebugDuplicateClasses FAILED
> Task :app:buildInfoGeneratorDebug

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:checkDebugDuplicateClasses'.
> 1 exception was raised by workers:
  java.lang.RuntimeException: Duplicate class android.support.v4.app.INotificationSideChannel found in modules classes.jar (androidx.core:core:1.0.0) and classes.jar (com.android.support:support-compat:28.0.0)
  Duplicate class android.support.v4.app.INotificationSideChannel$Stub found in modules classes.jar (androidx.core:core:1.0.0) and classes.jar (com.android.support:support-compat:28.0.0)
  Duplicate class android.support.v4.app.INotificationSideChannel$Stub$Proxy found in modules classes.jar (androidx.core:core:1.0.0) and classes.jar (com.android.support:support-compat:28.0.0)
  Duplicate class android.support.v4.graphics.drawable.IconCompatParcelizer found in modules classes.jar (androidx.core:core:1.0.0) and classes.jar (com.android.support:support-compat:28.0.0)
  Duplicate class android.support.v4.os.IResultReceiver found in modules classes.jar (androidx.core:core:1.0.0) and classes.jar (com.android.support:support-compat:28.0.0)
  Duplicate class android.support.v4.os.IResultReceiver$Stub found in modules classes.jar (androidx.core:core:1.0.0) and classes.jar (com.android.support:support-compat:28.0.0)
  Duplicate class android.support.v4.os.IResultReceiver$Stub$Proxy found in modules classes.jar (androidx.core:core:1.0.0) and classes.jar (com.android.support:support-compat:28.0.0)
  Duplicate class android.support.v4.os.ResultReceiver found in modules classes.jar (androidx.core:core:1.0.0) and classes.jar (com.android.support:support-compat:28.0.0)
  Duplicate class android.support.v4.os.ResultReceiver$1 found in modules classes.jar (androidx.core:core:1.0.0) and classes.jar (com.android.support:support-compat:28.0.0)
  Duplicate class android.support.v4.os.ResultReceiver$MyResultReceiver found in modules classes.jar (androidx.core:core:1.0.0) and classes.jar (com.android.support:support-compat:28.0.0)
  Duplicate class android.support.v4.os.ResultReceiver$MyRunnable found in modules classes.jar (androidx.core:core:1.0.0) and classes.jar (com.android.support:support-compat:28.0.0)
  Duplicate class androidx.core.graphics.drawable.IconCompatParcelizer found in modules classes.jar (androidx.core:core:1.0.0) and classes.jar (com.android.support:support-compat:28.0.0)
  Duplicate class androidx.core.internal.package-info found in modules classes.jar (androidx.core:core:1.0.0) and classes.jar (com.android.support:support-compat:28.0.0)
  Duplicate class androidx.versionedparcelable.CustomVersionedParcelable found in modules classes.jar (androidx.versionedparcelable:versionedparcelable:1.0.0) and classes.jar (com.android.support:versionedparcelable:28.0.0)
  Duplicate class androidx.versionedparcelable.NonParcelField found in modules classes.jar (androidx.versionedparcelable:versionedparcelable:1.0.0) and classes.jar (com.android.support:versionedparcelable:28.0.0)
  Duplicate class androidx.versionedparcelable.ParcelField found in modules classes.jar (androidx.versionedparcelable:versionedparcelable:1.0.0) and classes.jar (com.android.support:versionedparcelable:28.0.0)
  Duplicate class androidx.versionedparcelable.ParcelImpl found in modules classes.jar (androidx.versionedparcelable:versionedparcelable:1.0.0) and classes.jar (com.android.support:versionedparcelable:28.0.0)
  Duplicate class androidx.versionedparcelable.ParcelImpl$1 found in modules classes.jar (androidx.versionedparcelable:versionedparcelable:1.0.0) and classes.jar (com.android.support:versionedparcelable:28.0.0)
  Duplicate class androidx.versionedparcelable.ParcelUtils found in modules classes.jar (androidx.versionedparcelable:versionedparcelable:1.0.0) and classes.jar (com.android.support:versionedparcelable:28.0.0)
  Duplicate class androidx.versionedparcelable.VersionedParcel found in modules classes.jar (androidx.versionedparcelable:versionedparcelable:1.0.0) and classes.jar (com.android.support:versionedparcelable:28.0.0)
  Duplicate class androidx.versionedparcelable.VersionedParcel$1 found in modules classes.jar (androidx.versionedparcelable:versionedparcelable:1.0.0) and classes.jar (com.android.support:versionedparcelable:28.0.0)
  Duplicate class androidx.versionedparcelable.VersionedParcel$ParcelException found in modules classes.jar (androidx.versionedparcelable:versionedparcelable:1.0.0) and classes.jar (com.android.support:versionedparcelable:28.0.0)
  Duplicate class androidx.versionedparcelable.VersionedParcelParcel found in modules classes.jar (androidx.versionedparcelable:versionedparcelable:1.0.0) and classes.jar (com.android.support:versionedparcelable:28.0.0)
  Duplicate class androidx.versionedparcelable.VersionedParcelStream found in modules classes.jar (androidx.versionedparcelable:versionedparcelable:1.0.0) and classes.jar (com.android.support:versionedparcelable:28.0.0)
  Duplicate class androidx.versionedparcelable.VersionedParcelStream$FieldBuffer found in modules classes.jar (androidx.versionedparcelable:versionedparcelable:1.0.0) and classes.jar (com.android.support:versionedparcelable:28.0.0)
  Duplicate class androidx.versionedparcelable.VersionedParcelStream$InputBuffer found in modules classes.jar (androidx.versionedparcelable:versionedparcelable:1.0.0) and classes.jar (com.android.support:versionedparcelable:28.0.0)
  Duplicate class androidx.versionedparcelable.VersionedParcelable found in modules classes.jar (androidx.versionedparcelable:versionedparcelable:1.0.0) and classes.jar (com.android.support:versionedparcelable:28.0.0)
  Duplicate class androidx.versionedparcelable.VersionedParcelize found in modules classes.jar (androidx.versionedparcelable:versionedparcelable:1.0.0) and classes.jar (com.android.support:versionedparcelable:28.0.0)

  Go to the documentation to learn how to <a href="d.android.com/r/tools/classpath-sync-errors">Fix dependency resolution errors</a>.


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

* Get more help at https://help.gradle.org

Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/5.1.1/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 19s
25 actionable tasks: 11 executed, 14 up-to-date

更新AndroidX新错误后

Executing tasks: [:app:assembleDebug]


> Configure project :app
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)

> Task :app:buildInfoDebugLoader
> Task :app:preBuild UP-TO-DATE
> Task :app:preDebugBuild UP-TO-DATE
> Task :app:compileDebugAidl NO-SOURCE
> Task :app:checkDebugManifest UP-TO-DATE
> Task :app:compileDebugRenderscript NO-SOURCE
> Task :app:generateDebugBuildConfig UP-TO-DATE
> Task :app:mergeDebugShaders UP-TO-DATE
> Task :app:compileDebugShaders UP-TO-DATE
> Task :app:generateDebugAssets UP-TO-DATE
> Task :app:mergeDebugAssets UP-TO-DATE
> Task :app:writeDebugApplicationId UP-TO-DATE

> Task :app:processDebugGoogleServices
Parsing json file: C:\Users\bon300-36\AndroidStudioProjects\frinder-app\app\src\debug\google-services.json

> Task :app:createDebugCompatibleScreenManifests UP-TO-DATE
> Task :app:mainApkListPersistenceDebug UP-TO-DATE
> Task :app:processDebugManifest
> Task :app:fabricGenerateResourcesDebug UP-TO-DATE
> Task :app:prepareLintJar UP-TO-DATE
> Task :app:generateDebugSources
> Task :app:javaPreCompileDebug FAILED
> Task :app:buildInfoGeneratorDebug

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:javaPreCompileDebug'.
> Could not resolve all files for configuration ':app:debugAnnotationProcessorClasspath'.
   > Failed to transform artifact 'parceler.jar (org.parceler:parceler:1.1.6)' to match attributes {artifactType=processed-jar, org.gradle.usage=java-runtime-jars}
      > Execution failed for JetifyTransform: C:\Users\bon300-36\.gradle\caches\modules-2\files-2.1\org.parceler\parceler\1.1.6\52c727f86dc1b805eb5c7ee8a5d13824be4b1ff1\parceler-1.1.6.jar.
         > Failed to transform 'C:\Users\bon300-36\.gradle\caches\modules-2\files-2.1\org.parceler\parceler\1.1.6\52c727f86dc1b805eb5c7ee8a5d13824be4b1ff1\parceler-1.1.6.jar' using Jetifier. Reason: The given artifact contains a string literal with a package reference 'android.support.v4.widget' that cannot be safely rewritten. Libraries using reflection such as annotation processors need to be updated manually to add support for androidx.. (Run with --stacktrace for more details.)

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

* Get more help at https://help.gradle.org

BUILD FAILED in 1s
16 actionable tasks: 5 executed, 11 up-to-date

共有2个答案

方航
2023-03-14

使用

implementation 'androidx.constraintlayout:constraintlayout:1.1.3'

没有版本28

吕鸿朗
2023-03-14

您为约束布局定义的版本不可用。使用下面显示的一个。

    implementation 'com.android.support.constraint:constraint-layout:1.1.3'

更多信息在约束布局下面的链接中给出

 类似资料:
  • 问题内容: 我正在从事android问答游戏。QuestionActivity和EndgameActivity是我游戏中的2个类。我想将游戏的控制权转移到EndgameActivity。为此,我在QuestionActivty类中添加 在方法上。但是在回答了最后一个问题后,当我的游戏控制权没有转移到EndgameActivity时,日志猫显示了以下错误。 QuestionActivity课程- E

  • 我目前完全无法解决Hibernate的问题,我得到的消息是: 在以下方法中: 但是我在SQL中没有看到任何错误,它在阿帕奇德比中运行得很好。 我已经在 StackOverflow 和其他地方尝试了一些方法,但没有什么可以解决这个问题。 一个简单的应用程序中有两个类: 和书: 每个映射到数据库表: 而书是: 谁能告诉我哪里出了问题? 如果SQL最终起作用,如果我使用正确的方法将输出转换为Person

  • 这是Gradle控制台的输出。 任何关于如何修复这个preDexDebug错误的帮助都将是一个很大的帮助!顺便说一句,我也不能在左边的project explorer中看到我的“libs”文件夹。

  • 我试图使用Jenkins构建一个maven项目,结果出现了以下错误,整个构建失败了。Maven成功地从GIT中提取代码并进行处理。但POM误差无法纠正。请帮帮我.

  • 同步项目在开始时失败,我无法修复它。错误是gradle无法解析此依赖项。 知道怎么修好它吗?

  • 问题内容: 对于Java的最终结业,我们在测试中包含“异常”部分,其中包括try,catch和finally调用。当我尝试将示例代码放入Eclipse时,遇到了错误并抛出了新的领域。所有错误都显示“无法解析键入”。 如何解决此问题,以便可以学习/查看代码应该执行的操作? Q4类 Q4Exception类 问题答案: 我认为值得一提的是,在Eclipse中,Ctrl + Shif + O可以为您解决