ssiyy / excludeaar Goto Github PK
View Code? Open in Web Editor NEW用于过滤aar中冲突类(class)和so库的脚本,也可以用来过滤jar中冲突class
License: MIT License
用于过滤aar中冲突类(class)和so库的脚本,也可以用来过滤jar中冲突class
License: MIT License
我通过在dependence里面增加这样的配置,剔除掉了重复的部分:
excludePluginExt {
autoDependencies = true
aars {
"VGame-Core-1220" {
path "/libs/exclude/VGame-Core-1220.aar"
excludePackages 'com.ss.android.a', 'com.ss.android.download', 'com.ss.android.downloadad', 'com.ss.android.downloadlib', 'com.ss.android.socialbase'
}
}
}
然后编译成功了,运行时候失败,请问有什么办法可以搞定呢?
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/ss/android/downloadlib/addownload/GlobalInfo;
at com.ss.union.game.sdk.common.download.GameDownloadManager.doInit(SourceFile:154)
at com.ss.union.game.sdk.core.base.init.GameSdkCoreInit.init(SourceFile:69)
at com.ss.union.game.sdk.core.base.init.a.f.doIt(SourceFile:17)
Task :app:unZip_aar_DSAR_SDK
Execution optimizations have been disabled for task ':app:unZip_aar_DSAR_SDK' to ensure correctness due to the following reasons:
如题~
ERROR: Unable to resolve dependency for ':exclude-demo@debug/compileClasspath': Failed to transform file 'exclude_BaiduLBS_Android_debug.aar' to match attributes {artifactType=jar}
作者你好:
如果按照github项目中的方式来处理,那集成aar的方式就需要修改了吧,需要给每一个aar指定一个特定的configuration是么?感觉这样有点麻烦
能否直接根据aar的name来获取到aar文件路径呢?
楼主你好,有个问题想请教下:目前这个开源库是要先在
`
excludePluginExt {
autoDependencies = true //是否自动依赖即是否依赖过滤之后的架包
aars {
BaiduLBS_Android_debug { //过滤架包的名称
path "/libs/exclude/BaiduLBS_Android_debug.aar" //架包的路径
excludePackages 'com.baidu.location' //过滤的包名
}
}
jars{
BaiduLBS_Android_7_5_2{//过滤架包的名称
path "/libs/exclude/BaiduLBS_Android_7.5.2.jar" //架包的路径
excludePackages 'com.baidu.android','com.baidu.lbsapi' //过滤的包名
}
map_baidu{//过滤架包的名称
path "/libs/exclude/map-baidu.jar"//架包的路径
excludePackages "io.dcloud.js.map.adapter"//过滤的包名
excludeClasses "io.dcloud.js.map.IFMapDispose","io.dcloud.js.map.JsMapCircle","io.dcloud.js.map.MapJsUtil"//过滤的类名
}
}
}
`
这里声明要过滤的包名啥的,然后再执行指定的Task。如果要实现:先自动化检测主module跟放在libs/exclude文件夹内的aar文件之间存在的冲突包名,然后再过滤那些冲突的包名,这种该怎么实现呢?
JCenter is closing soon
比如我们项目的distributionUrl=https://services.gradle.org/distributions/gradle-4.9-all.zip
Task 'excludeAar_BaiduLBS_Android_debug' not found in root project 'ExcludeAar'.
Execution failed for task ':unzipJar_SystemUISharedLib'.
Cannot expand ZIP '/libs/SystemUISharedLib.jar' as it does not exist.
跑了demo也是这样 是不能用了吗
Unable to resolve dependency for ':app@debug/compileClasspath': Failed to transform file 'exclude_library-release.aar' to match attributes {artifactType=android-exploded-aar} using transform ExtractAarTransform
报错 Cannot add task 'unZip_jar_libchips' as a task with that name already exists.
excludePluginExt {
aars {
BaiduLBS_Android_debug { //过滤架包的名称
implementation = false
path = "/libs/excludes/BaiduLBS_Android_debug.aar" //架包的路径
// excludeClasses 'com.example.library.BaiduLocationService'
excludePackages = ['com.baidu.android', 'com.baidu.lbsapi']
// excludeSos 'liblocSDK7b'
// excludeSoAbis 'x86'
}
}
jars{
// android_opt_datetimepicker{//过滤架包的名称
// path = "/libs/android-opt-datetimepicker.jar" //架包的路径
// excludePackages "android","androidx" //过滤的包名
// }
libchips{//过滤架包的名称
path = "/libs/excludes/libchips.jar"//架包的路径
excludePackages 'android.arch','android.support','androidx'//过滤的包名
// excludeClasses "io.dcloud.js.map.IFMapDispose","io.dcloud.js.map.JsMapCircle","io.dcloud.js.map.MapJsUtil"//过滤的类名
}
}
}
excludePluginExt {
aars {
BaiduLBS_Android_debug { //过滤架包的名称
implementation = false //是否依赖过滤之后架包
path "/libs/exclude/BaiduLBS_Android_debug.aar" //架包的路径
excludePackages 'com.baidu.location' //过滤的包名
excludeSos 'liblocSDK7b'
excludeSoAbis 'x86'
}
}
jars{
BaiduLBS_Android_7_5_2{//过滤架包的名称
path "/libs/exclude/BaiduLBS_Android_7.5.2.jar" //架包的路径
excludePackages 'com.baidu.android','com.baidu.lbsapi' //过滤的包名
}
map_baidu{//过滤架包的名称
path "/libs/exclude/map-baidu.jar"//架包的路径
excludePackages "io.dcloud.js.map.adapter"//过滤的包名
excludeClasses "io.dcloud.js.map.IFMapDispose","io.dcloud.js.map.JsMapCircle","io.dcloud.js.map.MapJsUtil"//过滤的类名
}
}
}
如果想改成
excludePluginExt {
aars {
implementation = false //是否依赖过滤之后架包
path "/libs/exclude/BaiduLBS_Android_debug.aar" //架包的路径
excludePackages 'com.baidu.location' //过滤的包名
excludeSos 'liblocSDK7b'
excludeSoAbis 'x86'
}
}
这样的话,应该就不需要NamedDomainObjectContainer<>了吧?请问下应该怎么写这种
Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:processDevDebugManifest'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:103)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:73)
........
Caused by: java.lang.RuntimeException: com.android.manifmerger.ManifestMerger2$MergeFailureException: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1; 前言中不允许有内容。
at com.android.builder.core.AndroidBuilder.mergeManifestsForApplication(AndroidBuilder.java:548)
at com.android.build.gradle.tasks.MergeManifests.doFullTaskAction(MergeManifests.java:173)
at com.android.build.gradle.internal.tasks.IncrementalTask.taskAction(IncrementalTask.java:106)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
at org.gradle.api.internal.project.taskfactory.IncrementalTaskAction.doExecute(IncrementalTaskAction.java:50)
... 104 more
Caused by: com.android.manifmerger.ManifestMerger2$MergeFailureException: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1; 前言中不允许有内容。
at com.android.manifmerger.ManifestMerger2.loadLibraries(ManifestMerger2.java:965)
at com.android.manifmerger.ManifestMerger2.merge(ManifestMerger2.java:165)
at com.android.manifmerger.ManifestMerger2.access$600(ManifestMerger2.java:61)
at com.android.manifmerger.ManifestMerger2$Invoker.merge(ManifestMerger2.java:1542)
at com.android.builder.core.AndroidBuilder.mergeManifestsForApplication(AndroidBuilder.java:508)
... 117 more
Caused by: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1; 前言中不允许有内容。
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:203)
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:177)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:400)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:327)
at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:1437)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:999)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:606)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:118)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:848)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:777)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:643)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(SAXParserImpl.java:327)
at com.android.utils.PositionXmlParser.parse(PositionXmlParser.java:176)
at com.android.utils.PositionXmlParser.parse(PositionXmlParser.java:139)
...
去除class的目的达到了,但是依赖之后无法正确构建打包
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.