Android : crash because java class not found - android

My goal is to be able to make my Android TV Mi Box S (Oreo 8.1) transcode properly Dolby Digital+ (EAC3) sounds to Dolby Digital (AC3) and output it to, my AVR through SPDIF.
This transcodindg is possible with Kodi 18.1 applicition but is not proposed by other application or Android 8.1 settings. As Kodi is able to do it I reverse engineered Android stack. My conclusion are : - Android Oreo embeds any necessary codecs ans other stuff to do this transcoding but does not propose the settings to configure this - Android Pie proposes the wanted surround sound setting (output Dolby Digital on SPDIF)
So my goal is to backport Android TvSettings application from Pie to Oreo
I first tryed to generate TvSettings with Android Studio. I hacked the application resources but stopped when I understood that I would have to generate platfom dependacies (for instance SettingsLib.jar)
My second trial is to generate the entire Android platform. The build is complete and I can deploy TvSettings application on a x86 TV simulation BUT when I launched the TvSettings appplication I get this error :
--------- beginning of crash
2019-04-01 12:21:04.976 3987-3987/com.android.tv.settings
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.android.tv.settings, PID: 3987
java.lang.RuntimeException: Unable to get provider android.support.v4.content.FileProvider:
java.lang.ClassNotFoundException: Didn't find class
"android.support.v4.content.FileProvider" on path: DexPathList[[zip
file
"/data/app/com.android.tv.settings-2DkaCncwGQ874WP-kx3G4Q==/base.apk"],nativeLibraryDirectories=[/data/app/com.android.tv.settings-2DkaCncwGQ874WP-kx3G4Q==/lib/x86,
/system/lib, /vendor/lib]]
I searched this error on internet and it seems that it deals with multidex feature. This multidex feature is well documented for clean developped Android appliacation but nor reaally for applications extracted from Android platform and deployed with adb.
This problem is related to java libraries loading.
I found threads referring Android multidex feature but only for applications buils with Android Studio/Gradle and my app was build with Android platform
What can I do?

have you included fileProvider in your manifest?

Well there seems to be a root error during deployment of my TvSettings application. Here is its log :
E/dex2oat: Invalid version number in dex file header. File: base.apk
I read several pages and found this one very interesting : https://source.android.com/devices/tech/dalvik/configure
So, due to different optimizations, platform apps are not generated with the same file format that apps generated above platform API
My idea is to generate the whole platform including TvSettings app and to deploy TvSettings with adb. So the apk format may be wrong.
My next step is to add in TvSettings/Settings/Android.mk the flag below :
LOCAL_DEX_PREOPT := false

Related

Using an app bundle I get UnsatisfiedLinkError for <1% of users

I'm trying to use the new Android App Bundles.
I run some test locally on my devices, and everything works correctly. However, once deployed to production, I am starting to see a few errors like this:
java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/xyz/base.apk"],nativeLibraryDirectories=[/data/app/xyz/lib/arm, /vendor/lib, /system/lib]]] couldn't find "libsqlite3x.so"
java.lang.Runtime.loadLibrary (Runtime.java)
java.lang.System.loadLibrary (System.java)
io.requery.android.database.sqlite.SQLiteDatabase.<clinit> (SQLiteDatabase.java:86)
io.requery.android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked (SQLiteOpenHelper.java:241)
io.requery.android.database.sqlite.SQLiteOpenHelper.getReadableDatabase (SQLiteOpenHelper.java:199)
...
The error states that a library I'm using (requery/sqlite-android) cannot find the .so file that it needs.
This seems strange, since I checked with bundletool, and in every APK the file .so is there.
The error happens on two devices: a Samsung Galaxy Note 7 and a
TECNO-J8, running Android 6 and 5 respectively.
According to the Play Store, the error happens for app installed through Google Play, so I doubt the error is related to APK sideloading.
The generated APK bundle includes splits for the following architectures:
splits\base-armeabi_v7a.apk
splits\base-mips.apk
splits\base-arm64_v8a.apk
splits\base-x86_64.apk
splits\base-x86.apk
Do you have any hints?
Even though the installs are reported from Play, this information can easily be spoofed when using adb (which some users have learnt to do for some reason that I don't quite get yet). Those crashes very likely come from sideloads which don't install the config splits in spite of the appearances.
This issue might be related to https://issuetracker.google.com/issues/127691101
It happens on some devices of LG or old Samsung devices where the user has moved the app to the SD Card.
One way of fixing the issue is to use Relinker library to load your native libraries instead of directly calling System.load method.
https://github.com/KeepSafe/ReLinker
Another way is to block the movement of the app to the SD card or by keeping android.bundle.enableUncompressedNativeLibs=false in your gradle.properties file.
#see https://developer.android.com/guide/app-bundle/configure-base#disable_config_apks
disable bundle api split can fix this bug.
add this into your build.gradle file
bundle {
abi {
// This property is set to true by default.
enableSplit = false
}
}

Can't save core dump when using LLDB in android studio (osx)?

When using LLDB to debug an android project that uses native libraries, i'm unable to export the core dump.
I run my application and get a SIGSEGV in the debugger. Then I open the LLDB console in Android Studio and get the following when i try to export the core dump.
(lldb) process save-core ./core-20180730-174318
error: Failed to save core file for process: no ObjectFile plugins were able to save a core for this process
Currently SaveCore is only implemented for the MachO and PECOFF file formats, but not for ELF. Feel free to file a request for this with bugs.llvm.org and somebody will get around to it at some point. Or if you are interested in hacking on the debugger, you can have a go at implementing it yourself! The people on the lldb-dev (lldb-dev#lists.llvm.org) list would be more than happy to help you out if you want to try your hand at this.

Error while compiling Web RTC for Android

I am developing app of video chat in Web RTC.
I am going through documentation of Web RTC.
I have followed all steps mentioned for Getting the Code
export GYP_DEFINES="OS=android"
fetch --nohooks webrtc_android
gclient sync
I have all src code of web rtc in my root directory. As per documentation say we have to compile source to use in our application. Here i got error while compiling source using following command.
$ gn gen out/Default --args='target_os="android" target_cpu="arm"'
ERROR at //build/config/android/internal_rules.gni:636:3: Can't load input file.
import("//third_party/ijar/ijar.gni")
^-----------------------------------
Unable to load:
/Users/c86/webrtc-checkout/src/third_party/ijar/ijar.gni
I also checked in the secondary tree for:
/Users/c86/webrtc-checkout/src/build/secondary/third_party/ijar/ijar.gni
See //build/config/android/rules.gni:8:1: whence it was imported.
import("//build/config/android/internal_rules.gni")
^-------------------------------------------------
See //webrtc/examples/BUILD.gn:12:3: whence it was imported.
import("//build/config/android/rules.gni")
^----------------------------------------
See //BUILD.gn:13:5: which caused the file to be included.
"//webrtc/examples",
^------------------
How can I solve this? Am I going in right direction to develop app of video chat on Web RTC?
Building WebRTC for Android is only supported on Ubuntu(14 / 16).
Currently not supported in macOS.

How to play Audio file in Android QT?

i developed my application in QT, i am trying to port for android. my application working fine in android with few issues. the main issue is, i am not able to play the audio file when i am trying to put the audio file play Code i am getting error
QSound::play(FilePath);
Error: : -1: error: error: cannot find -lQtMultimediaKit
D:\Projects\test\demo.cpp:996: error: undefined reference to 'QSound::play(QString const&)'
my config: QT 4.8,QT Creator 2.5.83 and necessitas and windows XP
i am able to include the QSound Header file and using intellisense to type the QSound::Play no issue while typing when i am getting error on compilation. so i tried to look into the source folder and i found QSound.h header also.
How to play the Audio file in Android using QT?
in may case it works properly with no errors
my code:
player->setMedia(QUrl("qrc:/new/prefix1/1.mp3"));
// ok it works on windows
//also works on android
Stumblend in this one while searching info, this looks useful: http://qt-project.org/doc/qt-5/qml-qtmultimedia-mediaplayer.html
While the support of Audio for Android in QT is there, it's a journey through hell with the current release. If you want it stable in the end you'll end-up searching for external libraries anyway Take a look here
this works for me
file .pro
QTPLUGIN += qtaudio_coreaudio
QT += androidextras
QT += widgets
QT += quickcontrols2
file in Resources:
player2->setMedia(QUrl("qrc:/new/prefix1/folder_x/file.mp3"));
player2->play();

Problems with build.xml when using the Android ADK to communicate with an Arduino Mega ADK

So a few days ago I got my hands on an Arduino Mega ADK board, and the last couple of nights I have been setting up my development environment, getting to grips with the tools etc. The tools and libraries all work fine, for example I can get a program written in the Processing IDE to compile and run on an Asus Eee Pad Transformer TF101 running Android 4.03. But when I get it to try to compile and run one of the pre-written examples, it gives me a compiler error:
Android SDK Tools Revision 20
Installed at C:\NVPACK\android-sdk-windows
Project Type: Application
Project Target: Android 2.3.3
API level: 10
Library dependencies:
No Libraries
API<=15: Adding annotations.jar to the classpath.
Merging AndroidManifest files into one.
Manifest merger disabled. Using project manifest only.
No AIDL files to compile.
No RenderScript files to compile.
Generating resource IDs...
Generating BuildConfig class.
BUILD FAILED
C:\NVPACK\android-sdk-windows\tools\ant\build.xml:680: The following error occurred while executing this line:
C:\NVPACK\android-sdk-windows\tools\ant\build.xml:693: Compile failed; see the compiler error output for details.
Total time: 7 seconds
And that's all the console seems to output as well, which is rather frustrating! As far as I'm aware all of my SDK versions, tools and plugins are all up to date. I've tried this using a Linux partition I have on my hard drive and it produces the same error message, although it mentions a problem with the package com.Android.future.UsbAccessory. Given what I've seen, it seems that the problem is with the tools, either my directory structure doesn't match up to what the correct setup is, or something else is wrong :S. If anyone has had similar problems, some help would be smashing! (For the record, my setup was done using the instructions on the Arduino website, although I already had the Android SDK tools installed).
Will Scott-Jackson
It sounds like your haven't added in the support library to your project and/or you haven't downloaded it into your Android SDK.
The ADK1 demokit app targets API Level 10 (Android 2.3.3); That means you need to use the support libraries in your project and that's why the compiler is complaining about level 10 library dependencies not being available. The support libraries are a separate download in the SDK Manager, so you might not have them in your development environment.
In Android API Level 12 and higher, the USB Accessory protocol was added to the framework API, so there are two different ways to use the accessory protocol. So, you don't have to use the support libraries if you are targeting Honeycomb and higher versions, but you'll have to update the demokit app code to make this work.
Hope this helps.
So I've double checked my setup and started working on a project I had in mind, it seems to import the libraries appropriately. So far so good, but when I input:
ArduinoAdkUsb arduino;
void setup() {
arduino = new ArduinoAdkUsb(this);
//Other UI initialisation etc.
}
I get this error:
##name## ##version## by ##author##
FATAL EXCEPTION: Animation Thread
java.lang.NoClassDefFoundError: com.android.future.usb.UsbManager
at cc.arduino.ADKCommunication.<init>(Unknown Source)
at cc.arduino.ArduinoAdkUsb.<init>(Unknown Source)
at
processing.android.test.sketch_120730a.
sketch_120730a.setup(sketch_120730a.java:48)
at processing.core.PApplet.handleDraw(Unknown Source)
at processing.core.PGraphicsAndroid2D.requestDraw(Unknown Source)
at processing.core.PApplet.run(Unknown Source)
at java.lang.Thread.run(Thread.java:856)
After the app has been built and installed onto the Android tablet I am using. Any thoughts how I can over come this? From what I can tell, this has no problem finding com.android.future.usb.manager to compile and install the program, but once it tries to run it can find it.
Based on this tutorial from http://stream.tellart.com/controlling-arduino-with-android/
In the examples RGB_Arduino the name, version and author variables are set at the top of the sketch.
Try adding in this section of code at the top of your arduino sketch just underneath the library imports
// accessory descriptor. It's how Arduino identifies itself to Android
char applicationName[] = "Mega_ADK"; // the app on your phone
char accessoryName[] = "Mega_ADK"; // your Arduino board
char companyName[] = "Freeware";
// make up anything you want for these
char versionNumber[] = "1.0";
char serialNumber[] = "1";
char url[] = "http://labs.arduino.cc/adk/"; // the URL of your app online
//initialize the accessory:
AndroidAccessory usb(companyName, applicationName,
accessoryName,versionNumber,url,serialNumber);

Categories

Resources