-1

Now i'm trying to run clone app from git https://github.com/frinder/frinder-app This but the problem is that app made pretty long time ago so should to change bulid.gradle

but when i try to same sync implementation "com.android.support:animated-vector-drawable:28.0.0" but if i delete it keep going show to me error 28.0.0 It show like this

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...

but i don't know what makes not exact same version

This is that app build.gradle (Module)

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'


This is that app build.gradle (Project)

// 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
}

Manifest file here

<?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>

Error logcat

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

It makes Sync Failed

I want to solve the problem...

New Error When i run

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

After i Update AndroidX NEW Error

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

Hirose
  • 105
  • 12
  • 1
    [Check the official Constraint Layout release site](https://androidstudio.googleblog.com/2018/08/constraintlayout-113.html) to figure out the latest stable version of the 1.x branch is 1.1.3 and there are two artifacts, one for Androidx and one for the old support libraries (compatible with the latest support library 28.0.0) and the one you need. – Martin Marconcini Jul 03 '19 at 11:57
  • Thank you but after i fix that the 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. it show to me is it related with gradle? or... – Hirose Jul 03 '19 at 12:03
  • That error is not your problem. You problem is that you updated *all* your libraries at the same time to their latest versions; apparently one or more of your libraries is using AndroidX artifacts (and bringing them to your class path) and this is clashing. You need to slow down the blind-upgrade and start checking what dependencies are being brought by you explicitly, and what are transitive or dependencies of those dependencies and see if there's a mismatch or conflict. Check `gradlew dependencies` for more info. :) – Martin Marconcini Jul 03 '19 at 12:06
  • It makes me crazy really But Thank you so much !!! i'm trying to figure out – Hirose Jul 03 '19 at 12:12
  • I've been there a bunch of times (I work mostly as a contractor) and sometimes I get old projects and the client says: "we want to make this work again" and ... it's... painful. Good luck with yours! :) – Martin Marconcini Jul 03 '19 at 12:16

2 Answers2

1

Use

implementation 'androidx.constraintlayout:constraintlayout:1.1.3'

There is no version 28

Manoj Perumarath
  • 6,251
  • 4
  • 39
  • 57
  • can u see my new error? i added when i run it, it show i added and thanks sync is no more error show – Hirose Jul 03 '19 at 12:01
1

Version that you have defined for constraint layout is not available. Use the one shown below.

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

More information is given in the link below Constraint Layout

Vivek Mishra
  • 5,269
  • 7
  • 41
  • 74
  • 1
    The latest is 1.1.3. – Martin Marconcini Jul 03 '19 at 11:58
  • can u see my new error? i added when i run it, it show .. and thank you sync is no show error but new error showing after fix it – Hirose Jul 03 '19 at 12:00
  • Can you update in your question your updated app's build.gradle file – Vivek Mishra Jul 03 '19 at 12:01
  • 2
    The reason for what @VivekMishra just said is because during this _transition period_ (to give it a nice name) between Support and AndroidX, some libraries have been ported to use AndroidX artifacts, and some haven't. So there's a clash between what every library wants to bring as a transitive dependency... there are ways to exclude transitive dependencies, ask a different question or search around, it's a tedious process if the library conflicting is a dependency of a dependency of a dependency... you get the idea. :) (hint: `./gradlew app:dependencies` is usually a good friend :) – Martin Marconcini Jul 03 '19 at 12:04
  • 1
    Or for a easier solution migrate your project to Android X – Vivek Mishra Jul 03 '19 at 12:05
  • after migrate to Android X it occured new eorror TT * What went wrong: Execution failed for task ':app:javaPreCompileDebug'. > Could not resolve all files for configuration ':app:debugAnnotationProcessorClasspath'. – Hirose Jul 03 '19 at 12:11
  • wait, if you _migrated_ to AndroidX, then you will need to make sure all those libraries are using AndroidX or you're going to have to manage both at the same time (bad idea I think) – Martin Marconcini Jul 03 '19 at 12:16
  • Seems like your parceler dependency is causing issue. You need to exclude support library from that dependency – Vivek Mishra Jul 03 '19 at 12:17
  • You can see this link on how to exclude a specific module from a dependency. https://stackoverflow.com/questions/39332046/how-to-exclude-the-support-v4-library-from-the-studio – Vivek Mishra Jul 03 '19 at 12:18