Unable to merge DEX - Android Studio

Hi, how can i compile apk in android studio when i get this error:
Error:Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
> java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex
This happened when i try to use Appodeal SDK. They have 3 versions, normal, multidex and multidex over 64k methods. I tried all of them, same error. Version with 64k methods works fine, but when i tried to use image button and android studio download some libraries to use it, then this problem appear on this only working SDK too, now i can't use it.
Exist any fix for it, or any way how to disable multidex?

Related

[Q] Xposed module with sqlCipher

Hello,
I'm having a problem to load sqlCipher libs in my module.
I'm hooking PackageManagerService, so I'm under systemService context and in my DB Class CTOR i'm trying to execute: SQLiteDatabase.loadLibs(context);
I've all the necessary libs under libs directory and the needed zip file under assets
but i'm getting exception that the libs could not be found .
I've added them to the build path.
I also tried the same configuration with regular android application and it works there...
How can i add sqlCipher to my xposed model?
Thanks,
Hooked code runs as the hooked app. From the way you're loading sqlCipher (I'm not familiar with SQL libraries) that might be the problem.
GermainZ said:
Hooked code runs as the hooked app. From the way you're loading sqlCipher (I'm not familiar with SQL libraries) that might be the problem.
Click to expand...
Click to collapse
From my testing the first exception i get is when sqlCipher runs System.loadLibrary("stlport_shared");
the exception i get is:
*** FATAL EXCEPTION IN SYSTEM PROCESS: Thread-89
E/AndroidRuntime(22675): java.lang.UnsatisfiedLinkError: Couldn't load stlport_shared from loader dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.myapp-1.apk"],nativeLibraryDirectories=[/system/lib]]]: findLibrary returned null
E/AndroidRuntime(22675): at java.lang.Runtime.loadLibrary(Runtime.java:355)
E/AndroidRuntime(22675): at java.lang.System.loadLibrary(System.java:525)
shnapsi said:
From my testing the first exception i get is when sqlCipher runs System.loadLibrary("stlport_shared");
the exception i get is:
*** FATAL EXCEPTION IN SYSTEM PROCESS: Thread-89
E/AndroidRuntime(22675): java.lang.UnsatisfiedLinkError: Couldn't load stlport_shared from loader dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.myapp-1.apk"],nativeLibraryDirectories=[/system/lib]]]: findLibrary returned null
E/AndroidRuntime(22675): at java.lang.Runtime.loadLibrary(Runtime.java:355)
E/AndroidRuntime(22675): at java.lang.System.loadLibrary(System.java:525)
Click to expand...
Click to collapse
Well the Context you get in the hooked code isn't your app's but the system's context. Hooked code really is completely unrelated to your app – forget you're using Xposed and assume the modification is directly happening in the APK you're hooking. You can't access your app's resources/files/… normally.
So with all that in mind, I don't know if there's a way to directly load the library.
You could try getting your app's context from an existing context (see Context.createApplicationContext(…)). Alternatively, you might have to do the modification from your app instead (by e.g. sending a broadcast from the hooked app to your normal app when necessary).
Of course, maybe there's a way I don't know about.

Proguard, Minify, and stacktrace

I am getting an "Unfortunately Has Stopped" message in my release version that does not occur in the debug version. This happens both on my S4 mini and on the Samsung RTL devices. The debug version works on all of these devices plus on the Genymotion emulators. The error occurs using Jsoup when i tap my menu choice which activates Jsoup.connect.
So far i have determined that the problem is most likely caused by ProGuard, in the minify process. The release program does run if i set minifyEnabled to false but i would prefer to un-apply it just where necessary. So i need to know a few things ...
1. what is the syntax for the proguard statement to eliminate org.jsoup.* from being minified
2. which file is this statement to be added to, proguard-android.txt or proguard-rules.pro
3. how do i initiate a stack trace? It must be simple but my searches have not turned up a step by step procedure for this. I believe that with a stack trace i could identify which specific Jsoup modules need to be eliminated from minify rather than minifying the complete lib
It seems that these are very basic questions. Virtually every post that i have read on these subjects assumes that you know these things. Hope you can help.
Mick
OK, making a little progress.
Found this example -keep class org.joda.time. { ; }** so I substituted jsoup in place of joda, put it into the proguard-rules.pro file and my release build now runs
I found the -s or --stacktrace option and where to set it in the IDE. However I am lost about where to find the actual stacktrace when I run the program. I would appreciate any help i can get on how to get a stack trace, especially while running a release version of the program

Compiling Code from older Android Studio / Gradle / React Native Version errors

Hello All,
I am new with programming for Android and could use some help compiling someone else's code I have as I am attempting to test a older App for educational use and debugging experience. I have not yet been able to get the code to run, and I have done some searches and tried a few approaches already without luck so I am just hoping someone may point me in to the right direction of what I am missing.
I believe most of my issues may lie in versioning of old dependencies so I have been trying to compile with older version of Android Studio (as well as current version initially) along with matching versions of Gradle and React-Native, all without luck. Here are the version details I can see from the code...
From looking at the code I know it is using:
React-Native 0.53.3
Yarn Package Manager
Gradle 2.2.3
From Top level build.gradle:
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
....
repositories {
mavenLocal()
jcenter()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
From sub level build.gradle:
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
From gradle-wrapper.properties:
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
At this point I have multiple copies of the code that I have tried different gradle versions and react-native versions along with current and older Android studio with a plethora of different compile issues with each setup that I have not been able to solve so I think it may be best for me to start again with a clean version of the code as a new AS project, and I hope some of you more experienced guys might be able to point me in the right direction for setting this up to get it to compile.
Should I try again to match the original AS version, Gradle Version, and React Native version the code was written for? Is their anything I am missing or just try to compile from there and debug errors that arise?
I just did a Quick test on Studio 2.3.3 - I select import gradle and select the build.gradle from the source code.
Error79, 0) Could not read script 'C:\...\node_modules\react-native\react.gradle' as it does not exist."
I then run npm install in project root directory
Sync Gradle Build and run I get:
"Unable to load script from assets 'index.android.bundle' Make sure your bundle is package correctly or your running a packager server"
Build errors on Studio 3.3.1:
> "ERROR: Could not get unknown property 'mergeResourcesProvider' for
> object of type
> com.android.build.gradle.internal.api.ApplicationVariantImpl."
Any help and suggestions are truly appreciated!

Unable to create signed APK in Android Studio 2021.2.1 Patch 1

Hello all,
Wondering if I'm the only one with this issue. I'm trying to generate a signed APK using Android Studio (Build->Generate Signed Bundle / APK...).
However, during the process, an exception is thrown:
Code:
2022-07-19 14:57:49,526 [ 337069] ERROR - intellij.openapi.progress.Task - sun/misc/BASE64Encoder
java.lang.NoClassDefFoundError: sun/misc/BASE64Encoder
This is with the JRE that ships with Android Studio.
I dug into this a bit and found in places that this is a problem caused by running Java 11, since this class was deprecated in Java 9. However, when I run Android Studio with Java 8, it won't load since it complains about needing a later version of Java.
Does anybody else have this problem? Any suggested work-around/hacks for this?
Incidentally - I'm running on Ubuntu, and tried it with the OpenJDK version 8. Haven't tried with the Oracle version of Java yet.
Thanks!

Bluetooth Stops working after first reboot?

I recently downgraded my rog phone 3 from android 12 to android 11 while rooting it with twrp and magisk. After I did this, everything worked fine on my system (besides mms for a moment), once it is flashed, the first reboot afterwards completely stops bluetooth from functioning. No startup, nothing. The drivers are just nonfunctional I guess. Anyone else have this issue/ know how to solve? Not very fluent in this and just looking to fix this asap.
Also here is a logcat error that shows itself when I try to enable bluetooth.
FATAL EXCEPTION: BluetoothDatabaseManager
Process: com.android.bluetooth, PID: 2430
android.database.sqlite.SQLiteCantOpenDatabaseException: Cannot open database '/data/user_de/0/com.android.bluetooth/databases/bluetooth_db': Directory /data/user_de/0/com.android.bluetooth/databases doesn't exist
at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:252)
at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:205)
at android.database.sqlite.SQLiteConnectionPool.openConnectionLocked(SQLiteConnectionPool.java:505)
at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:206)
at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:198)
at android.database.sqlite.SQLiteDatabase.openInner(SQLiteDatabase.java:918)
at android.database.sqlite.SQLiteDatabase.open(SQLiteDatabase.java:898)
at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:762)
at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:751)
at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:373)
at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:316)
at androidx.sqlite.db.framework.FrameworkSQLiteOpenHelper$OpenHelper.getWritableSupportDatabase(FrameworkSQLiteOpenHelper.java:145)
at androidx.sqlite.db.framework.FrameworkSQLiteOpenHelper.getWritableDatabase(FrameworkSQLiteOpenHelper.java:106)
at androidx.room.RoomDatabase.inTransaction(RoomDatabase.java:476)
at androidx.room.RoomDatabase.assertNotSuspendingTransaction(RoomDatabase.java:281)
at com.android.bluetooth.btservice.storage.MetadataDao_Impl.load(MetadataDao_Impl.java:258)
at com.android.bluetooth.btservice.storage.MetadataDatabase.load(MetadataDatabase.java:95)
at com.android.bluetooth.btservice.storage.DatabaseManager$DatabaseHandler.handleMessage(DatabaseManager.java:124)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:248)
at android.os.HandlerThread.run(HandlerThread.java:67)
Caused by: android.database.sqlite.SQLiteCantOpenDatabaseException: unknown error (code 14 SQLITE_CANTOPEN): Could not open database
at android.database.sqlite.SQLiteConnection.nativeOpen(Native Method)
at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:224)
... 20 more
I really need help with this if anyone could spare the time.
I have dumped the same stock rom I installed and I have noticed it is missing the bluetooth APEX file. Is it even possible to install an APEX file without reinstalling an entire system? I know the format is similar to APK and i have read/write access to my system partition, so is it possible to do?
Try setting selinux to permissive (from a root command line, run "setenforce 0"). I have a similar issue (messed up permissions when downgrading and I'm trying to debug it now. I'm trying to figure out how to fix those permissions without disabling selinux entirely, as disabling it is a massive security hole.

Categories

Resources