前言
今天在写demo的时候,引用了一个库,我自己的studio是sdk25,而引用的库的版本是sdk28,studio3.3的,版本较高,于是出现“error: failed linking references.”
解决办法
这里我首先将我app_module对应的
compileSdkVersion 25
修改为
compileSdkVersion 28
,然后下面引用的
implementation 'com.android.support:appcompat-v7:25.3.1'
报错,按提示修改为
implementation 'com.android.support:appcompat-v7:28.0.0'
运行提示:
Manifest merger failed : uses-sdk:minSdkVersion 15 cannot be smaller than version 19 declared in library [com.github.ShaoqiangPei:DemoUtil:1.0.1] C:\Users\pei\.gradle\caches\transforms-1\files-1.1\DemoUtil-1.0.1.aar\4a17a0a126acdb405884346818052524\AndroidManifest.xml as the library might be using APIs not available in 15
Suggestion: use a compatible library with a minSdk of at most 15,
or increase this project's minSdk version to at least 19,
or use tools:overrideLibrary="com.lib" to force usage (may lead to runtime failures)
ok,按提示将 app_module中的 minSdkVersion 15 改为 minSdkVersion 19,编译,运行,就可以了。
看来,低的sdk配置的项目在引用高sdk配置的第三方库,还是存在兼容问题啊。