【发布时间】:2018-05-11 04:23:18
【问题描述】:
我一直在寻找如何找出库之间的依赖关系,但我没有找到任何东西。例如。在我的 build.gradle 中是
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile 'com.android.support:support-annotations:25.4.0'
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.4.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support.constraint:constraint-layout-solver:1.0.2'
testCompile 'junit:junit:4.12'
androidTestCompile 'com.android.support.test:runner:1.0.1'
androidTestCompile 'com.android.support.test:rules:1.0.1'
// androidTestCompile 'org.hamcrest:hamcrest-library:1.3'
androidTestCompile 'com.android.support.test.espresso:espresso-core:3.0.1'
androidTestCompile 'com.android.support.test.uiautomator:uiautomator-v18:2.1.3'
我怎么知道我可以使用哪些版本? (例如,com.android.support:support-annotations:25.4.0 是否与 com.android.support:appcompat-v7:25.4.0 等兼容?)这是在某处记录的吗? 例如,Android Studio 告诉我我可以通过将行突出显示为黄色并说出较新版本来使用较新版本。但是,如果我更改它,我最终会得到运行测试但不构建应用程序时构建的配置。反之亦然。
例如,我收到一个错误
错误:任务执行失败 ':app:transformClassesWithInstantRunForDebug'。
意外输入:ImmutableJarInput{name=com.android.support:support-media-compat:25.3.1, 文件=C:\MyApp\app\build\intermediates\transforms\desugar\debug\73.jar, contentTypes=CLASSES,范围=EXTERNAL_LIBRARIES,状态=删除}, ImmutableJarInput{name=com.android.support:animated-vector-drawable:25.3.1, 文件=C:\MyApp\app\build\intermediates\transforms\desugar\debug\69.jar, contentTypes=CLASSES,范围=EXTERNAL_LIBRARIES,状态=删除}, ImmutableJarInput{name=com.android.support:appcompat-v7:25.3.1, 文件=C:\MyApp\app\build\intermediates\transforms\desugar\debug\68.jar, contentTypes=CLASSES,范围=EXTERNAL_LIBRARIES,状态=删除}, ImmutableJarInput{name=com.android.support:support-vector-drawable:25.3.1, 文件=C:\MyApp\app\build\intermediates\transforms\desugar\debug\70.jar, contentTypes=CLASSES,范围=EXTERNAL_LIBRARIES,状态=删除}, ImmutableJarInput{name=com.android.support:support-v4:25.3.1, 文件=C:\MyApp\app\build\intermediates\transforms\desugar\debug\71.jar, contentTypes=CLASSES,范围=EXTERNAL_LIBRARIES,状态=删除}, ImmutableJarInput{name=com.android.support:support-compat:25.3.1, 文件=C:\MyApp\app\build\intermediates\transforms\desugar\debug\76.jar, contentTypes=CLASSES,范围=EXTERNAL_LIBRARIES,状态=删除}, ImmutableJarInput{name=com.android.support:support-core-ui:25.3.1, 文件=C:\MyApp\app\build\intermediates\transforms\desugar\debug\75.jar, contentTypes=CLASSES,范围=EXTERNAL_LIBRARIES,状态=删除}, ImmutableJarInput{name=com.android.support:support-core-utils:25.3.1, 文件=C:\MyApp\app\build\intermediates\transforms\desugar\debug\74.jar, contentTypes=CLASSES,范围=EXTERNAL_LIBRARIES,状态=删除}, ImmutableJarInput{name=com.android.support:support-annotations:25.3.1, 文件=C:\MyApp\app\build\intermediates\transforms\desugar\debug\77.jar, contentTypes=CLASSES,范围=EXTERNAL_LIBRARIES,状态=删除}, ImmutableJarInput{name=com.android.support:support-fragment:25.3.1, 文件=C:\MyApp\app\build\intermediates\transforms\desugar\debug\72.jar, contentTypes=CLASSES, scopes=EXTERNAL_LIBRARIES, status=REMOVED}
【问题讨论】:
-
只是建议,用 AS 3 在 gradle 3 上进行搜索,他们将编译更改为 implementation/api/other one 我不记得
-
你可以在这里找到这个问题的解决方案:stackoverflow.com/a/38004549/5219299