I need help in how to set the target and compile Sdk versions separately for bazel.
I want to run tensorflow on the phone following this tutorial. After editing WORKSPACE for bazel as follows:
android_sdk_repository(
name = "androidsdk",
api_level = 24,
build_tools_version = "24.0.1",
path = "/home/Android/Sdk",
)
android_ndk_repository(
name="androidndk",
path="/home/Android/Sdk/ndk-bundle",
api_level=21)
I get PARSE ERROR on the phone upon apk installing:
adb install -r bazel-bin/tensorflow/examples/android/tensorflow_demo.apk
I have usb debugging and 3rd party apk installation enabled. The phone uses Android 4.4.4 so I changed WORKSPACE configuration to match it (tools and API installed by SDK manager properly) as:
android_sdk_repository(
name = "androidsdk",
api_level = 19,
build_tools_version = "19.1.0",
path = "/home/Android/Sdk",
)
android_ndk_repository(
name="androidndk",
path="/home/Android/Sdk/ndk-bundle",
api_level=21)
Upon building as:
bazel build //tensorflow/examples/android:tensorflow_demo
I end up with few errors of that type:
Error at 5 : /tmp/android_resources_tmp7060220119759636814/merged_resources/values-v21/values.xml:5: error: Error retrieving parent for item: No resource found that matches the given name 'android:Theme.Material.Light'.
Following this answer, I should build for compile API version > 21 but at the same time target API version 19. It can be easily set for gradle. However I have not found any clue how to do that for bazel. Any suggestions are appreciated!
If you want to target a lower Android API level, the file you want to edit is actually tensorflow/examples/android/AndroidManifest.xml. Leave the WORKSPACE file settings at the highest API level you have installed via your sdk (APIs can be installed with $ANDROID_HOME/tools/android).
You can lower the min API level to 19 in AndroidManifest.xml, but be aware you will encounter runtime errors on your phone running the demo unless you replace the demo code that interfaces with the camera2 api (which was added with API level 21) with analogous android.hardware.camera code.
Related
I am interested in using the AServiceManager_get/addService() APIs that are made available via the NDK implementation of binder, libbinder_ndk.
The sources for this can be found here for 10.0.0r30 - API29, and in your AOSP tree at:
$SDK/frameworks/native/libs/binder/ndk/
However, the libbinder_ndk.so bundled with the latest r21c NDK does not have all of these APIs exported. Many are, but the get/add services endpoints are not available. The libbinder_ndk.so for API29 can be found at:
$NDK/platforms/android-29/$PLAT/usr/lib/libbinder_ndk.so
As well as the sysroot directories of each respective toolchain, but only for API29
$NDK/toolchains/llvm/prebuilt/$HOST/sysroot/usr/lib/$PLAT/29/libbinder_ndk.so
But the symbols are of course available if you build the AOSP tree for this same release:
$ readelf --wide -s libbinder_ndk.so | grep AService
180: 000000000000e148 256 FUNC GLOBAL DEFAULT 15 AServiceManager_addService##LIBBINDER_NDK
181: 000000000000e248 244 FUNC GLOBAL DEFAULT 15 AServiceManager_checkService##LIBBINDER_NDK
224: 000000000000e33c 244 FUNC GLOBAL DEFAULT 15 AServiceManager_getService##LIBBINDER_NDK
In fact, a search of the documentation returns no results for these APIs, but the source has been available since 2018-08-20 according to the blame records.
Am I missing something?
The reason they are not exported is because they are not a part of the app API surface. They exist for vendor and APEX modules. Those domains do not have the same API permanence guarantees that apps do (read: they might disappear in any given release).
My apk file format is like this:
xxxx-debug.apk
xx-xxx-debug-xxx-1.0.1.apk
I can download the apk files but I cannot install them. I'm facing the following error:
Parse error
There was a problem while parsing the package.
Code used for Installation:
protected void install(String fileName) {
Intent install = new Intent(Intent.ACTION_VIEW);
install.setDataAndType(Uri.fromFile(new File(fileName)),"application/vnd.android.package-archive");
startActivity(install);
}
When the apk file are downloaded, a number is appended at the end of the file e.g. some.apk becomes some-1.apk.
What I have tried/checked so far:
check on the option “Unknown sources.”
uses-permission android:name="android.permission.INSTALL_PACKAGES" tools:ignore="ProtectedPermissions"
android device version is 5.0.1
apk files are not corrupted because I've managed to install it in a different way
Please try disabling instant run and then generate apk.It will work.Hope it helps.
I faced this issue previously. This is how I debugged it.
First, install the APK through terminal
adb install path_to_your_app/name_of_your_app.apk
if you get error message:
adb: failed to install name_of_your_app.apk: Failure [INSTALL_FAILED_NO_MATCHING_ABIS: Failed to extract native libraries
this means that the architecture that you are building mismatches with the emulator architecture.
The way I fixed this issue is by forcing the build architecture in build.gradle
buildTypes {
debug {
ndk {
abiFilters 'x86_64'
}
Hope this helps
I had this same problem and for me the issue was the Minimum API Level. I had the minimum API too high, which means some devices were not able to use the app. In Unity go to: Player Settings > Other Settings > Identification >
Minimum API Level: This should be set to the minimum which for me Android 4.4 'KitKat' (API level 19)
Maximum API Level: This should be set to the maximum according to Google, see link https://developer.android.com/distribute/best-practices/develop/target-sdk
While decompiling and checking my app with apktool I found that there is no uses-sdk tag in manifest file.How android system is able to detect the android minimum version and target version the app supports at run time.
there is uses-sdk but when decompile code its avilable in apktool.yml file
check apktool.yml file where you have decompile code its look like
version: 1.5.2
apkFileName: pt.yourpackage.apk
isFrameworkApk: false
usesFramework:
ids:
- 1
sdkInfo:
minSdkVersion: '7'
targetSdkVersion: '15'
packageInfo:
cur_package: pt.yourpackage.apk
orig_package: pt.yourpackage.apk
compressionType: false
I've started getting a weird error message when trying to upload a playbook app update to BlackBerry world. I think this problem started after installing version 1.6.1 of their eclipse plugin.
The error message:
"The package version in your .bar manifest file for signals_playbook must be greater than the previous version, but lower than any the next release version added to the vendor portal. . Your .bar manifest file package version must be greater than 3.0. Correct your .bar manifest file and try again to continue."
My AndroidManifest.xml contains:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="ca.rcp.mobile.cror.signals"
android:versionCode="7"
android:versionName="3.1" >
The Manifest file contained within the BAR shows this info:
Archive-Manifest-Version: 1.1
Archive-Created-By: Apk2Bar version 1.6.1
Package-Author: xxxxxxxx
Package-Author-Id: some hash xxxxxxxxx
Package-Name: xxxxx.cror.signals
Package-Id: some hash xxxxxxxxx
Package-Version: 1.0.7.1
Package-Version-Id: some hash xxxxxxxx
Package-Type: application
Package-Architecture: armle-v7
Package-Author-Certificate-Hash: some hash xxxxx
Application-Name: Railway Signals
Application-Id: some hash xxxxxxxx
Application-Version: 1.0.7.1
Application-Version-Id: some hash xxxxxxxxxxx
Application-Requires-System: Tablet OS/2.0.0.7109
My system:
Windows 7 x64 using Eclipse 3.7.2 with latest ADT and updates.
I can see why BlackBerry world is complaining, it thinks the version number is 1.0.7.1. How do I get it to show 3.1.0.0??
I tried editing the manifest file contained within the bar, saving it and resubmitting. But that didn't work (didn't think it would but was worth a try).
Does anyone know where is the 1.0.7.1 coming from?
Can I override it?
Thanks
Rob
We suddenly started having the same problem with our builds. Evidently something changed in the BlackBerry build tools. Try setting the application's android:versionName attribute to a 4-part value (such as 3.1.0.1). BlackBerry has always used this format (major.minor.micro.build) for native apps. It seems that unless your Android manifest has the same format, the BlackBerry build tools fail to parse the versionName attribute and use a fall-back. From what I can tell, the fall-back is to use the value of android:versionCode as the micro version in a default application version code; that is it sets the app version in the .bar file manifest to
1.0.<android:versionCode value>.1
(I sure wouldn't want to be the engineer that had to defend implementing this behavior.)
An alternative approach is to create a custom manifest file that has the app version you want. Create a file named MANIFEST.MF in the same directory as AndroidManifest.xml. Then add the specific .bar manifest entries you want. For instance, it might be:
Archive-Manifest-Version: 1.1
Package-Version: 3.1.0.0
Application-Version: 3.1.0.0
Then open the project properties in Eclipse, navigate to BlackBerry, and for the "Custom BAR Manifest" drop-down, select "Add custom values (merge)".
Thank you, Ted!
There is another link on this topic;
http://supportforums.blackberry.com/t5/BlackBerry-World-Development/The-package-version-in-your-bar-manifest-file-for-New-Bundle/td-p/2754567
We started to notice problem after move to Gradle:
Before
AndroidManifest.xml:
android:versionCode="1312310309" android:versionName="2.28.4"
MANIFEST.MF:
Application-Version: 14.1231.309.0
After
AndroidManifest.xml:
android:versionCode="134" android:versionName="2.30.31402271059"
MANIFEST.MF
Application-Version: 1.0.134.0
I also had the same problem but I fixed it by adding this line in my Android Manifest file android:versionCode="30" previously I had android:versionCode="29" so upgraded it by one .And the problem got fixed for me.
Looking at the example code in the docs http://developer.android.com/reference/android/content/Context.html#getExternalFilesDir%28java.lang.String%29
File path = getExternalFilesDir(Environment.DIRECTORY_PICTURES);
It does not compile on 2.1
The static fields DIRECTORY_PICTURES, DIRECTORY_MUSIC etc. don't seem to be found.
Update:
Using the filter api checkbox, I see that it was removed in Android 2.2 (or api version 8). So the manifest file needs to contain minSdk defined as 7.
That's because this was added in Android 2.2 (API Level 8). See "Filter by API Level" in top right corner.