gradle 版本冲突解决

0.

Error:Conflict with dependency 'com.android.support:multidex' in project ':app'. Resolved versions for app (1.0.3) and test app (1.0.1) differ. See http://g.co/androidstudio/app-test-app-conflict for details.

http://blog.csdn.net/qq_28486273/article/details/78849506 https://github.com/talklittle/TestMultidex102 https://www.reddit.com/r/androiddev/comments/6n4lcu/wheres_multidex_102/

compile 'com.android.support:multidex:1.0.3'
androidTestCompile 'com.android.support:multidex:1.0.3'
androidTestCompile 'com.android.support:multidex-instrumentation:1.0.3'

1.插件 app/build.gradle顶部增加 apply plugin: 'project-report' 执行 gradlew.bat projectReport gradlew.bat -DsocksProxyHost=127.0.0.1 -DsocksProxyPort=1080 projectReport 在浏览器中打开生成的html链接

搜索 com.android.support:multidex:1.0.3 com.android.support:multidex-instrumentation:1.0.3

2.内置任务 gradle -q app:dependencies gradle -q app:dependencies > depen.txt

3.统一版本

所有工程

allprojects {
    //将配置一次性地应用于所有的Project
    repositories {
        maven { url 'https://maven.google.com' }
        maven { url 'https://dl.google.com/dl/android/maven2/' }
        jcenter()
    }
    configurations.all {
        resolutionStrategy {
            eachDependency { details ->
                // Force all of the primary support libraries to use the same version.
                if (details.requested.group == 'com.android.support'
                        && details.requested.name != 'multidex'
                        && details.requested.name != 'multidex-instrumentation') {
                    details.useVersion "27.1.0"
                }
                // Force all the error-prone dependencies to use the same version.
                if (details.requested.group == 'com.android.support'
                        && (details.requested.name.startsWith('multidex') || details.requested.name.startsWith('multidex-instrumentation'))) {
                    details.useVersion "1.0.3"
                }
            }
        }
    }
}

或者

allprojects {
    //将配置一次性地应用于所有的Project
    repositories {
        maven { url 'https://maven.google.com' }
        maven { url 'https://dl.google.com/dl/android/maven2/' }
        jcenter()
    }

    configurations.all {
        resolutionStrategy {
            force 'com.android.support:multidex:1.0.3'
            force 'com.android.support:multidex-instrumentation:1.0.3'
        }
    }

}

除主工程外

subprojects {
    //配置所有的子Project(不包含根Project)
    repositories {
        maven { url 'https://maven.google.com' }
        maven { url 'https://dl.google.com/dl/android/maven2/' }
        jcenter()
    }
    configurations.all {
        resolutionStrategy {
            eachDependency { details ->
                // Force all of the primary support libraries to use the same version.
                if (details.requested.group == 'com.android.support'
                        && details.requested.name != 'multidex'
                        && details.requested.name != 'multidex-instrumentation') {
                    details.useVersion "27.1.0"
                }
                // Force all the error-prone dependencies to use the same version.
                if (details.requested.group == 'com.android.support'
                        && (details.requested.name.startsWith('multidex') || details.requested.name.startsWith('multidex-instrumentation'))) {
                    details.useVersion "1.0.3"
                }
            }
        }
    }
    task subTask << {
        println project.name
    }
}

https://github.com/facebook/shimmer-android https://github.com/tabassumLatif/ShimmerRecyclerView https://github.com/sharish/ShimmerRecyclerView http://facebook.github.io/shimmer-android/ https://github.com/team-supercharge/ShimmerLayout

https://stackoverflow.com/questions/36857713/place-holder-list-item-like-facebook-for-content-loading http://mercury.io/blog/the-psychology-of-waiting-loading-animations-and-facebook




Enjoy Reading This Article?

Here are some more articles you might like to read next:

  • Claude Code CLI 新手使用指南
  • AndroidX,migrate,jetifier
  • KDE Connect Indicator
  • BusyBox
  • Source for Android 28