android 动态依赖版本号,android – 了解测试库版本/依赖项

博客讨论了在Android Studio中管理Gradle依赖时遇到的问题,特别是关于库版本的兼容性。作者提到,虽然Android Studio会提示更新依赖版本,但更改后可能会导致构建错误。文中提供了一个具体的错误信息,涉及多个`com.android.support`库版本冲突。解决方案是清理项目构建文件后重新构建。
摘要由CSDN通过智能技术生成

我正在寻找一段时间如何找出库之间的依赖关系,但我没有找到任何东西.例如.在我的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告诉我,我可以使用更新的版本,将行突出显示为黄色并说出更新的版本.但是如果我改变它,我最终会得到构建,如果我运行测试但不构建应用程序.或相反亦然.

例如,我收到一个错误

Error:Execution failed for task

‘:app:transformClassesWithInstantRunForDebug’.

Unexpected inputs: ImmutableJarInput{name=com.android.support:support-media-compat:25.3.1,

file=C:\MyApp\app\build\intermediates\transforms\desugar\debug\73.jar,

contentTypes=CLASSES, scopes=EXTERNAL_LIBRARIES, status=REMOVED},

ImmutableJarInput{name=com.android.support:animated-vector-drawable:25.3.1,

file=C:\MyApp\app\build\intermediates\transforms\desugar\debug\69.jar,

contentTypes=CLASSES, scopes=EXTERNAL_LIBRARIES, status=REMOVED},

ImmutableJarInput{name=com.android.support:appcompat-v7:25.3.1,

file=C:\MyApp\app\build\intermediates\transforms\desugar\debug\68.jar,

contentTypes=CLASSES, scopes=EXTERNAL_LIBRARIES, status=REMOVED},

ImmutableJarInput{name=com.android.support:support-vector-drawable:25.3.1,

file=C:\MyApp\app\build\intermediates\transforms\desugar\debug\70.jar,

contentTypes=CLASSES, scopes=EXTERNAL_LIBRARIES, status=REMOVED},

ImmutableJarInput{name=com.android.support:support-v4:25.3.1,

file=C:\MyApp\app\build\intermediates\transforms\desugar\debug\71.jar,

contentTypes=CLASSES, scopes=EXTERNAL_LIBRARIES, status=REMOVED},

ImmutableJarInput{name=com.android.support:support-compat:25.3.1,

file=C:\MyApp\app\build\intermediates\transforms\desugar\debug\76.jar,

contentTypes=CLASSES, scopes=EXTERNAL_LIBRARIES, status=REMOVED},

ImmutableJarInput{name=com.android.support:support-core-ui:25.3.1,

file=C:\MyApp\app\build\intermediates\transforms\desugar\debug\75.jar,

contentTypes=CLASSES, scopes=EXTERNAL_LIBRARIES, status=REMOVED},

ImmutableJarInput{name=com.android.support:support-core-utils:25.3.1,

file=C:\MyApp\app\build\intermediates\transforms\desugar\debug\74.jar,

contentTypes=CLASSES, scopes=EXTERNAL_LIBRARIES, status=REMOVED},

ImmutableJarInput{name=com.android.support:support-annotations:25.3.1,

file=C:\MyApp\app\build\intermediates\transforms\desugar\debug\77.jar,

contentTypes=CLASSES, scopes=EXTERNAL_LIBRARIES, status=REMOVED},

ImmutableJarInput{name=com.android.support:support-fragment:25.3.1,

file=C:\MyApp\app\build\intermediates\transforms\desugar\debug\72.jar,

contentTypes=CLASSES, scopes=EXTERNAL_LIBRARIES, status=REMOVED}

解决方法:

我也遇到了这个问题,并且能够通过从项目中删除构建文件夹并在之后构建/运行应用程序来修复它.

标签:android-studio,android

来源: https://codeday.me/bug/20190722/1500740.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值