I have a libary I wrote years ago and I've very gradually modualrised it and deployed to jfrog
https://github.com/sentinelweb/vectoroid-sdk
There are 3 modules:
vectoroid-android-base
(svg read/render, base vector classes)
vectoroid-android-draw
(drawing view)
vectoroid-android-views
(supporting views)
So draw module uses base & vectoroid-android-views
So I've ben updating it as there is an app I want to build with it but there is a problem with the supporting views lib
vectoroid-android-views
isn't putting the resources in the correct folder in the AAR file the folders under res (drawable, layout,...) should go at the top level in the AAR but for some resason there is a res folder and the drawable folder and resources are put there. So it looks like there is a bad source set or something - just for views module, the other seem to build properly.
github: https://github.com/sentinelweb/vectoroid-sdk
repo is: git clone https://github.com/sentinelweb/vectoroid-sdk.git
then: cd vectoroid-sdk
branch is: git checkout maintenance/update_build_2019
then these keys in ~./gradle/gradle.properties
SW_JCENTER_API_KEY=xxx
SW_JCENTER_USER=xxx
and to build AAR its: ./gradlew install
Then in the vectoroid-android-views/build/outputs/aar/vectoroid-android-views-release.aar
-> .zip
-> unzip - as I said, the resources should be in the top level folders but they go under the res
folder. Hence when using draw module I get the following build error.
Caused by: com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource linking failed
/Users/robmunro/.gradle/caches/transforms-2/files-2.1/924af02d6aaccd5e74b8bf41ac8ad0bc/res/values/values.xml:168:5-177:10: AAPT: error: resource drawable/butt_short (aka uk.co.sentinelweb.rememe:drawable/butt_short) not found.
And, errm, the code is very shonky - I wrote it 8 yrs ago - hopefully I have grown as a dev since then ;) - It will get fixed up.
The structure of the AAR is correct, the structure should be:
res/
values/
<stuff here>
layout/
<stuff here>
drawable/
<stuff here>
classes.jar
public.txt
R.txt
AndroidManifest.xml
https://developer.android.com/studio/projects/android-library#aar-contents
Except your packaging somehow also adds empty top-level folders:
res/
values/
<stuff here>
layout/
<stuff here>
drawable/
<stuff here>
values/
layout/
drawable/
classes.jar
public.txt
R.txt
AndroidManifest.xml
but I don't think that could cause an issue other than being weird.
I suspect an X/Y problem ;)
Reading the error message of AAPT:
.gradle/caches/.../res/values/values.xml resource drawable/butt_short (aka app:drawable/butt_short) not found.
butt_short.xml
is not visible to the app.views
artifact is not on the compile classpath of the app using the draw
artifact.draw
to views
is not recognised.~/.m2/uk/co/sentinelweb/vectoroid-android-draw/0.1.3/vectoroid-android-draw-0.1.3.pom
, you can see that it has no dependencies.I confirmed this by creating an empty project:
// don't forget src/main/AndroidManifest.xml: <manifest package="com.test" />
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.2'
}
}
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
buildToolsVersion "28.0.3"
defaultConfig {
minSdkVersion 14
targetSdkVersion 28
}
}
repositories {
mavenLocal() // for consuming vectoroid local `gradlew install`
google() // for AAPT2
}
dependencies {
implementation 'uk.co.sentinelweb:vectoroid-android-draw:0.1.3'
// TODO uncomment to make it assemble correctly
// implementation 'uk.co.sentinelweb:vectoroid-android-views:0.1.3'
}
In the SDK I recommend using
implementation project(':vectoroid-android-views')
implementation project(':vectoroid-android-base')
instead of
implementation 'uk.co.sentinelweb:vectoroid-android-views:0.1.3'
implementation 'uk.co.sentinelweb:vectoroid-android-base:0.1.3'
and updating the defunct com.github.dcendents.android-maven
plugin to something that works. For example I've seen many gradle-mvn-push.gradle floating around.