I'm currently building a SDK and I provide a .aar archive to the users of the SDK.
I got an optional feature in my SDK that basically blurs the image.
However, this feature requires to use renderScript which make the .aar archive larger due to the presence of shared libraries.
./jni/armeabi-v7a:
total 3752
rw-rr- 1 cylix wheel 1,1M 29 nov 16:16 libblasV8.so
rw-rr- 1 cylix wheel 746K 29 nov 16:16 libRSSupport.so
rw-rr- 1 cylix wheel 46K 29 nov 16:16 librsjni.so
./jni/mips:
total 5224
rw-rr- 1 cylix wheel 1,5M 29 nov 16:16 libblasV8.so
rw-rr- 1 cylix wheel 1,0M 29 nov 16:16 libRSSupport.so
rw-rr- 1 cylix wheel 70K 29 nov 16:16 librsjni.so
./jni/x86:
total 5344
rw-rr- 1 cylix wheel 1,6M 29 nov 16:16 libblasV8.so
rw-rr- 1 cylix wheel 958K 29 nov 16:16 libRSSupport.so
rw-rr- 1 cylix wheel 54K 29 nov 16:16 librsjni.so
./jni/arm64-v8a:
total 1808
rw-rr- 1 cylix wheel 843K 29 nov 16:16 libRSSupport.so
rw-rr- 1 cylix wheel 60K 29 nov 16:16 librsjni.so
But I have noticed that if I remove the libraries and don't provide them in the .aar, the client of the library can still enable renderScript on its side and access the feature without any problem.
Then, I just have to check in my code if renderScript is available:
try {
Class.forName("android.support.v8.renderscript.RenderScript");
} catch (ClassNotFoundException e) {
//! renderScript not available
}
But here is my issue.
I still need to put in my gradle file:
renderscriptTargetApi 23
renderscriptSupportModeEnabled true
otherwise, the project can't compile.
But this causes the automatic inclusion of the .so files listed above...
Is there any way to counter that: being able to compile the renderScript features but filter the .so files so that they are not included in the .aar archive?
I believe there are better solutions. But the low hanging fruit here is to use com.android.tools.build:gradle:2.2.0 or higher.
dependencies {
classpath 'com.android.tools.build:gradle:2.2.1'
// ...
}
gradle plugin 2.2.0+ will not bundle libblasV8.so unless you specify renderscriptSupportModeBlasEnabled true. This way your AAR file will probably reduce 50% weight.
Miao's answer worked for me, but I had a few more ideas.
If all you need is blur, you might be able to avoid support.v8 all together, and just use native RenderScript sdk.
It depends on your minSdkVerison and needs. ScriptIntrinsicBlur was added in 17, or you could also just use a custom .rs kernel. It would be less performant than the ScriptIntrinsic, but it would let you support older versions.
Ok, I found out a solution. Maybe not the clean one, but at least it works.
I simply copied the renderscript-v8.jar from the android SDK library of my computer and put it into my project as a dependency.
Then, I removed the Gradle file configuration of renderscript
renderscriptTargetApi 23
renderscriptSupportModeEnabled true
That way, I can compile thanks to the .jar and I dont have any heavy .so in my .aar because Gradle doesn't build any of them anymore automatically.
Then, the user of my SDK can either chose to enable renderscript or not.
Related
I try to change the version while publishing a android project to my local maven repository.
Simple publishing works fine with./gradlew publishToMavenLocal.
While researching I found out that it should be possible to override the version number of my maven package on executing the publishing process. But when executing for example publishToMavenLocal -Pversion="asdf" this does not change the version in anyway. it seems like it is ignored.
I got the idea of the -Pversion flag from the comments of this post
Furthermore also the gradle docs say that it should be possible to override the version in some way when building it:
Overriding the default identity values is easy: simply specify the
groupId, artifactId or version attributes when configuring the
MavenPublication.
i don't know if i got anything wrong but is there a way to override the version of a maven package. Also publishing something like -SNAPSHOT to my local maven repo would help me a lot.
It works for me with Gradle 7.6.
$./gradlew publishToMavenLocal -Pversion=31
...
BUILD SUCCESSFUL in 1s
21 actionable tasks: 18 executed, 3 up-to-date
$ls -al ~/.m2/repository/com/foo/bar/client
total 8
drwxr-xr-x 4 johnkramer staff 128 Jan 26 18:05 .
drwxr-xr-x 5 johnkramer staff 160 Jan 26 18:05 ..
drwxr-xr-x 6 johnkramer staff 192 Jan 26 18:05 31
-rw-r--r-- 1 johnkramer staff 334 Jan 26 18:05 maven-metadata-local.xml
I am using Corona SDK and I am trying to compile my app for Android. I have been able to compile for iOS.
When compiling using either a fully signed distribution key or a debug key I am given the following error:
Build Failed: Error code: 256
The full error is as follows:
Sep 23 01:24:00.635 Building Android app for mgr****#**.com with 2017.3135
Sep 23 01:24:02.541 BUILD SUCCESSFUL
Total time: 0 seconds
Sep 23 01:24:02.542
Sep 23 01:25:24.905 BuildID: 59c5a9a30bb42
Sep 23 01:25:34.119 [exec] Result: 1
Sep 23 01:25:36.428 BUILD FAILED
/Applications/Corona/Corona Simulator.app/Contents/Resources/build.xml:479: The following error occurred while executing this line:
/Applications/Corona/Corona Simulator.app/Contents/Resources/build.xml:454: jarsigner returned: 1
Total time: 6 seconds
Sep 23 01:25:36.539 Android build failed (256) after 95 seconds
Sep 23 01:25:36.816 ERROR: Build Failed: Error code: 256
I have tried Google Play and Amazon targets with the same outcome.
Any ideas massively appreciated.
I was able to compile the exact same files on a different machine (Windows) without an issue. I guess this is down to the Java installation on the other machine.
Interestingly, Corona required the 32-bit version of Java on Windows, which meant downloading a slightly older SDK/JDK (latest SDK only has 64-bit builds). My Mac has the latest 64-bit build, which Corona does not complain about, but isn't able to build with.
I have an app with complicated database structure. When I use command "adb shell dumpsys meminfo [package name]", it shows information as followings:
DATABASES
pgsz dbsz Lookaside(b) cache Dbname
4 20 41 2/1514/3 /data/user/0/[packagename]/databases/a.db
4 740 26 129/1375/2 /data/user/0/[packagename]/databases/b.db
4 64 21 0/1409/1 /data/user/0/[packagename]/databases/c.db
4 64 27 1/1408/2 /data/user/0/[packagename]/databases/c.db (3)
4 64 57 12/1411/5 /data/user/0/[packagename]/databases/c.db (2)
4 32 35 12/1514/3 /data/user/0/[packagename]/databases/d.db
4 20 28 13/1381/2 /data/user/0/[packagename]/databases/e.db
4 20 28 1/1513/2 /data/user/0/[packagename]/databases/f.db
4 16 21 0/1514/1 /data/user/0/[packagename]/databases/g.db
4 19164 84 124/1517/6 /data/user/0/[packagename]/databases/h.db
My questions are
why I get 3 c.db?
why number of middle cache value (cache miss-hit count?) are increased every seconds?
Thanks in advance!
Add:
I found out that when I using WAL mode and multiple threads to access database at the same time, it will create a lots connections until I call database.close() after accessing database. Are there any ideas how to handle it?
I am trying to build Android OS. I've set up my machine and everything is going on fine, but selecting the device configuration is my concern. When I type lunch, I get:
1 arm-eng
2 aosp_shamu-userdebug
3 aosp_fugu-userdebug
4 aosp_flounder-userdebug
5 aosp_hammerhead-userdebug
6 aosp_flo-userdebug
7 aosp_deb-userdebug
8 full_manta-userdebug
9 full_mako-userdebug
10 full_grouper-userdebug
11 full_tilapia-userdebug
12 full_maguro-userdebug
13 aosp_toro-userdebug
14 (toroplus) aosp_toroplus-userdebug
15 aosp_panda-userdebug
16 full_wingray-userdebug
17 full_crespo-userdebug
18 full_crespo4g-userdebug
I have a device called Injoo 1s, that's what I want to use to test. How do I choose which configuration. Or, I've to write some codes to fix that. Your response would be appreciated. Thank You.
The lunch combos are configured via files called vendorsetup.sh. Your device should have such a file under <android>/device/<your-vendor>/<your-device> with the following contents:
add_lunch_combo <your-device>-eng
add_lunch_combo <your-device>-user
I am using Apache POI in my android application to read xlsx file stored in SDCARD.
I am using following jar libs from Apache POI
poi-ooxml-schemas-3.9-20121203.jar
poi-ooxml-3.9-20121203.jar
But when I try to Run Android App I am getting below mentioned stacktrace.
trouble writing output: Too many methods: 66024; max is 65536. By package:
13 java.lang
1 java.lang.reflect
5 java.util
1 javax.xml.namespace
66 org.apache.xmlbeans
19 org.apache.xmlbeans.impl.values
1 org.apache.xmlbeans.impl.xb.xmlschema
2500 org.openxmlformats.schemas.drawingml.x2006.chart
1430 org.openxmlformats.schemas.drawingml.x2006.chart.impl
8767 org.openxmlformats.schemas.drawingml.x2006.main
5258 org.openxmlformats.schemas.drawingml.x2006.main.impl
86 org.openxmlformats.schemas.drawingml.x2006.picture
33 org.openxmlformats.schemas.drawingml.x2006.picture.impl
745 org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing
417 org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.impl
230 org.openxmlformats.schemas.drawingml.x2006.wordprocessingDrawing
164 org.openxmlformats.schemas.drawingml.x2006.wordprocessingDrawing.impl
298 org.openxmlformats.schemas.officeDocument.x2006.customProperties
256 org.openxmlformats.schemas.officeDocument.x2006.customProperties.impl
617 org.openxmlformats.schemas.officeDocument.x2006.docPropsVTypes
596 org.openxmlformats.schemas.officeDocument.x2006.docPropsVTypes.impl
285 org.openxmlformats.schemas.officeDocument.x2006.extendedProperties
196 org.openxmlformats.schemas.officeDocument.x2006.extendedProperties.impl
23 org.openxmlformats.schemas.officeDocument.x2006.math
24 org.openxmlformats.schemas.officeDocument.x2006.relationships
2 org.openxmlformats.schemas.officeDocument.x2006.relationships.impl
2076 org.openxmlformats.schemas.presentationml.x2006.main
1224 org.openxmlformats.schemas.presentationml.x2006.main.impl
1 org.openxmlformats.schemas.schemaLibrary.x2006.main
7271 org.openxmlformats.schemas.spreadsheetml.x2006.main
4556 org.openxmlformats.schemas.spreadsheetml.x2006.main.impl
11448 org.openxmlformats.schemas.wordprocessingml.x2006.main
9217 org.openxmlformats.schemas.wordprocessingml.x2006.main.impl
4 schemaorg_apache_xmlbeans.system.sE130CAA0A01A7CDE5A2B4FEB8B311707
1170 schemasMicrosoftComOfficeExcel
1223 schemasMicrosoftComOfficeExcel.impl
285 schemasMicrosoftComOfficeOffice
124 schemasMicrosoftComOfficeOffice.impl
2 schemasMicrosoftComOfficePowerpoint
3 schemasMicrosoftComOfficeWord
2858 schemasMicrosoftComVml
2529 schemasMicrosoftComVml.impl
[2013-11-25 21:20:32 - CRD] Conversion to Dalvik format failed with error 2
Can anyone tell where am I missing?
If you use too much code for any android app, the compilation will throw this error. The similar problem is stated and resolved here. You should split the app in parts as a plugin, in the form of a separate APK available for download. That APK would expose some component that the main app would use. There are various app on google play of such kind.
Please note that there are a number of problems when using Apache POI on Android. The one you are hitting can be solved by the so called "multiDex" feature in newer versions of Android.
There are currently two projects which try to solve most of the problems for you:
https://github.com/andruhon/android5xlsx
https://github.com/centic9/poi-on-android/ (mainted by me)
The first one is currently based on POI 3.12, whereas the second can be re-compiled with newer versions of POI more easily.