(1) 在app的build.gradle中加入以下配置
android{
......
}
// 配置下
repositories {
flatDir {
dirs 'libs'
}
}
dependencies {
......
}
(2) 将aar文件拷贝到app/libs目录下(例如test.aar)
(3)app的build.gradle中引入
implementation(name: 'test', ext: 'aar')
(1)jar
1、jar包放入lib文件夹下
2、studio file add as library即可
ps:
- 也可以吧jar包放入lib文件夹后,直接相应的gradle文件中语法引入(效果同上)
- 也可以吧jar包放入lib文件夹后,通过project scructure 引入(效果同上)
(2)module的依赖
1、新建module
2、app的build中添加依赖
/**
* 此处的括号不可省略,groovy允许在 顶级表达式 中可以省略方法的括号。
* 某些情况下是不可省略的。我们尽量不省略为好。
* */
implementation project (":autotrackappviewscreensdk")
其实也就比studio自建的多配置了一步
/**
* get App versionName
* @param context
* @return
*/
public String getVersionName(Context context){
PackageManager packageManager=context.getPackageManager();
PackageInfo packageInfo;
String versionName="";
try {
packageInfo=packageManager.getPackageInfo(context.getPackageName(),0);
versionName=packageInfo.versionName;
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
}
return getResources().getString(R.string.version)+" " +versionName;
}
PackageInfo里面有好多包的信息
(1)log
Warning: there were 2 unresolved references to classes or interfaces.
You may need to add missing library jars or update their versions.
If your code works fine without the missing classes, you can suppress
the warnings with '-dontwarn' options.
快速解决,混淆添加:-ignorewarnings 试试
(2)其他原因
可能是混淆文件引起,检查下。
可能原因:
工程的 local.propertry (文件里面是你的本地sdk路径配置)文件 丢失 项目的run按钮 变灰.
解决:
找个工程copy一份
打开cmd
keytool -list -keystore jks文件的路径(找到文件拖入cmd也行)
(1)问题产生
之前还跑的好好的一个项目,过几天再打开一跑就这样啦。
(2)log
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processDevDebugResources'.
> Android resource linking failed
Output: E:\ASWorkPlace\MultipleScannerPlus\app\build\intermediates\incremental\mergeDevDebugResources\merged.dir\values\values.xml:2386: error: resource anim/abc_popup_enter (aka com.multiple.scanner.plus.nmd:anim/abc_popup_enter) not found.
E:\ASWorkPlace\MultipleScannerPlus\app\build\intermediates\incremental\mergeDevDebugResources\merged.dir\values\values.xml:2387: error: resource anim/abc_popup_exit (aka com.multiple.scanner.plus.nmd:anim/abc_popup_exit) not found.
E:\ASWorkPlace\MultipleScannerPlus\app\build\intermediates\incremental\mergeDevDebugResources\merged.dir\values\values.xml:2390: error: resource anim/abc_grow_fade_in_from_bottom (aka com.multiple.scanner.plus.nmd:anim/abc_grow_fade_in_from_bottom) not found.
E:\ASWorkPlace\MultipleScannerPlus\app\build\intermediates\incremental\mergeDevDebugResources\merged.dir\values\values.xml:2391: error: resource anim/abc_shrink_fade_out_from_bottom (aka com.multiple.scanner.plus.nmd:anim/abc_shrink_fade_out_from_bottom) not found.
E:\ASWorkPlace\MultipleScannerPlus\app\build\intermediates\incremental\mergeDevDebugResources\merged.dir\values\values.xml:2394: error: resource anim/abc_tooltip_enter (aka com.multiple.scanner.plus.nmd:anim/abc_tooltip_enter) not found.
E:\ASWorkPlace\MultipleScannerPlus\app\build\intermediates\incremental\mergeDevDebugResources\merged.dir\values\values.xml:2395: error: resource anim/abc_tooltip_exit (aka com.multiple.scanner.plus.nmd:anim/abc_tooltip_exit) not found.
E:\ASWorkPlace\MultipleScannerPlus\app\build\intermediates\incremental\mergeDevDebugResources\merged.dir\values\values.xml:2558: error: resource color/abc_btn_colored_borderless_text_material (aka com.multiple.scanner.plus.nmd:color/abc_btn_colored_borderless_text_material) not found.
E:\ASWorkPlace\MultipleScannerPlus\app\build\intermediates\incremental\mergeDevDebugResources\merged.dir\values\values.xml:2561: error: resource color/abc_btn_colored_text_material (aka com.multiple.scanner.plus.nmd:color/abc_btn_colored_text_material) not found.
E:\ASWorkPlace\MultipleScannerPlus\app\build\intermediates\incremental\mergeDevDebugResources\merged.dir\values\values.xml:2615: error: resource drawable/abc_list_selector_holo_dark (aka com.multiple.scanner.plus.nmd:drawable/abc_list_selector_holo_dark) not found.
E:\ASWorkPlace\MultipleScannerPlus\app\build\intermediates\incremental\mergeDevDebugResources\merged.dir\values\values.xml:2667: error: resource drawable/abc_list_selector_holo_dark (aka com.multiple.scanner.plus.nmd:drawable/abc_list_selector_holo_dark) not found.
E:\ASWorkPlace\MultipleScannerPlus\app\build\intermediates\incremental\mergeDevDebugResources\merged.dir\values\values.xml:2699: error: resource color/abc_background_cache_hint_selector_material_dark (aka com.multiple.scanner.plus.nmd:color/abc_background_cache_hint_selector_material_dark) not found.
E:\ASWorkPlace\MultipleScannerPlus\app\build\intermediates\incremental\mergeDevDebugResources\merged.dir\values\values.xml:2702: error: resource color/abc_primary_text_material_dark (aka com.multiple.scanner.plus.nmd:color/abc_primary_text_material_dark) not found.
E:\ASWorkPlace\MultipleScannerPlus\app\build\intermediates\incremental\mergeDevDebugResources\merged.dir\values\values.xml:2703: error: resource color/abc_primary_text_material_light (aka com.multiple.scanner.plus.nmd:color/abc_primary_text_material_light) not found.
E:\ASWorkPlace\MultipleScannerPlus\app\build\intermediates\incremental\mergeDevDebugResources\merged.dir\values\values.xml:2704: error: resource color/abc_primary_text_disable_only_material_dark (aka com.multiple.scanner.plus.nmd:color/abc_primary_text_disable_only_material_dark) not found.
E:\ASWorkPlace\MultipleScannerPlus\app\build\intermediates\incremental\mergeDevDebugResources\merged.dir\values\values.xml:2705: error: resource color/abc_secondary_text_material_dark (aka com.multiple.scanner.plus.nmd:color/abc_secondary_text_material_dark) not found.
E:\ASWorkPlace\MultipleScannerPlus\app\build\intermediates\incremental\mergeDevDebugResources\merged.dir\values\values.xml:2706: error: resource color/abc_secondary_text_material_light (aka com.multiple.scanner.plus.nmd:color/abc_secondary_text_material_light) not found.
E:\ASWorkPlace\MultipleScannerPlus\app\build\intermediates\incremental\mergeDevDebugResources\merged.dir\values\values.xml:2707: error: resource color/abc_secondary_text_material_dark (aka com.multiple.scanner.plus.nmd:color/abc_secondary_text_material_dark) not found.
E:\ASWorkPlace\MultipleScannerPlus\app\build\intermediates\incremental\mergeDevDebugResources\merged.dir\values\values.xml:2708: error: resource color/abc_secondary_text_material_light (aka com.multiple.scanner.plus.nmd:color/abc_secondary_text_material_light) not found.
E:\ASWorkPlace\MultipleScannerPlus\app\build\intermediates\incremental\mergeDevDebugResources\merged.dir\values\values.xml:2709: error: resource color/abc_hint_foreground_material_dark (aka com.multiple.scanner.plus.nmd:color/abc_hint_foreground_material_dark) not found.
E:\ASWorkPlace\MultipleScannerPlus\app\build\intermediates\incremental\mergeDevDebugResources\merged.dir\values\values.xml:2710: error: resource color/abc_hint_foreground_material_light (aka com.multiple.scanner.plus.nmd:color/abc_hint_foreground_material_light) not found.
Command: C:\Users\Avazu Holding\.gradle\caches\transforms-1\files-1.1\aapt2-3.2.0-4818971-windows.jar\9b77b5b42259ae47c6f73ccea7616b21\aapt2-3.2.0-4818971-windows\aapt2.exe link -I\
E:\AsSDK\platforms\android-28\android.jar\
--manifest\
E:\ASWorkPlace\MultipleScannerPlus\app\build\intermediates\merged_manifests\devDebug\processDevDebugManifest\merged\AndroidManifest.xml\
-o\
E:\ASWorkPlace\MultipleScannerPlus\app\build\intermediates\processed_res\devDebug\processDevDebugResources\out\resources-devDebug.ap_\
-R\
@E:\ASWorkPlace\MultipleScannerPlus\app\build\intermediates\incremental\processDevDebugResources\resources-list-for-resources-devDebug.ap_.txt\
--auto-add-overlay\
--java\
E:\ASWorkPlace\MultipleScannerPlus\app\build\generated\not_namespaced_r_class_sources\devDebug\processDevDebugResources\r\
--custom-package\
com.android.scanner.master.plus\
-0\
apk\
--output-text-symbols\
E:\ASWorkPlace\MultipleScannerPlus\app\build\intermediates\symbols\dev\debug\R.txt\
--no-version-vectors
Daemon: AAPT2 aapt2-3.2.0-4818971-windows Daemon #0
* 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.
(3)原因分析系统的一些文件找不到啦
(4)解决 更新下gradle版本试试
网上说是gradle的一些bug,我更新到推荐的3.4.2就ojbk了
(1)背景接入一个sdk后出现bug
* What went wrong:
Execution failed for task ':app:processDevDebugManifest'.
> Manifest merger failed : Attribute application@fullBackupContent value=(@xml/vungle_backup_rule) from [com.github.vungle:vungle-android-sdk:6.3.24] AndroidManifest.xml:16:9-60
is also present at [:function_karmaSdk.1.0.2:] AndroidManifest.xml:66:9-66 value=(@xml/app_full_back_up_content).
Suggestion: add 'tools:replace="android:fullBackupContent"' to <application> element at AndroidManifest.xml:10:5-53:19 to override.
(2)分析
通过log可以看出是两个依赖中都有各自的manifest文件,而且他们的application节点的 android:fullBackupContent=""具有不同的属性值导致。
(3)解决
android:fullBackupContent="@xml/app_full_back_up_content"
tools:replace="android:fullBackupContent"
在你的app的清单文件下application节点添加属性替换即可。替换的值我们根据自己冲突的选择即可。