Questions tagged [dexclassloader]

Android dalvik.system.DexClassLoader class loader loads classes from .jar and .apk files containing a classes.dex entry. This class can allow code execution not installed as part of an Android application.

dalvik.system.DexClassLoader was added in API level 3.

See also

  1. http://developer.android.com/reference/dalvik/system/DexClassLoader.html
  2. http://developer.android.com/reference/dalvik/system/BaseDexClassLoader.html
73 questions
3
votes
1 answer

Can't read resources when running methods from dex file

I had a jar file that contains code and resources (ResourceBundle). I've created a simple project in android studio with that jar, compiled it, extracted the .apk and copied the classes.dex to a second project. Also copied the resources from the…
ox_
  • 805
  • 1
  • 7
  • 14
3
votes
3 answers

Class resolved by unexpected DEX;

I am developing a application which automatically load class from external dex from external apk file (external apk file is stored in internal storage of application). The external apk file have class using com.google.gson. The source code of the…
Richard Le
  • 639
  • 2
  • 9
  • 20
3
votes
1 answer

DexClassLoader - adding functionality

I'm doing some testing with DexClassLoader, to see if it's possible to "update" my app with new functionality. Currently I've got this method for testing, which works with testClass and running the test() method.. What I would like to know, is how…
olealgo
  • 479
  • 11
  • 23
2
votes
2 answers

Failed to install extracted secondary dex & java.io.IOException: unable to open DEX file

Hardware information phone: Huawei Mate 7(MT7-TL10) OS: Android 4.4.2 CPU: Kirin925 Build.gradle android { compileSdkVersion 27 defaultConfig { minSdkVersion 15 targetSdkVersion 25 } dependencies { …
haiyang wu
  • 33
  • 1
  • 5
2
votes
1 answer

Android unloading classloader cause crash

I'm working on an android app and I'm trying to plugin-like feature which would allow loading additional dex files to extend app functionality. I've figured out how to load additional dex files extending PathClassLoader with few small changes to…
2
votes
0 answers

Android classloader for optimized dex (odex) files

I am attempting to find a class loader that works for optimized dex files (odex files). I looked through all the android documentation and found the following class…
Jon
  • 1,381
  • 3
  • 16
  • 41
2
votes
0 answers

Loading native libraries from a dynamically loaded apk using DexClassLoader

I am loading the dex file from an APK dynamically using DexClassLoader and the APK contains native libraries also packaged in the following paths, library.apk ├── classes.dex ├── lib ├── armeabi-v7a ├──…
Codebender
  • 14,221
  • 7
  • 48
  • 85
2
votes
2 answers

How to use the DexClassLoader?

I want to add .jar dynamically. So I make a demo. But I don't know how to new the DexClassLoader. I don't know how to add the first params. final File optimizedDexOutputPath = new File("" + File.pathSeparator + "test.jar"); //PackageManager pm =…
CoolEgos
  • 47
  • 1
  • 10
2
votes
1 answer

Android DexClassLoader error, 'optimized data directory .. not owned by current user'

I am trying to produce a simple android application that can load a DEX file from the SD card at run-time. The application has two activites. The first activity is a simple screen that has a button. When the button is pressed, the second activity…
saul
  • 111
  • 2
  • 6
2
votes
2 answers

DexClassLoder - Didn't find class on path

I'm trying to load classes from external JAR file placed on sdcard. Many people used DexClassLoader successfuly. My steps: 1) Create classes.dex file from jar file: dx --dex --output=classes.dex file.jar 2) Add generated classes.dex file to jar 3)…
nikman
  • 41
  • 7
2
votes
3 answers

Android Multidex list all classes

i would like to use the ApplicationWrapepr approach to use multidex in my application like described here https://plus.google.com/104023661970539138053/posts/YTMf8ADTcFg I used the --minimal-main-dex option along with a keep file like…
Denny1989
  • 639
  • 1
  • 9
  • 15
1
vote
0 answers

Is it possible to use a ClassLoader to load a class implementing a package private interface loaded by another ClassLoader?

I have two separate ClassLoaders, one have loaded the package private interface A: package com.example; interface A {} And I have another class loader created from a dex file containing class B: package com.example; class B implements A { …
el_chupacabra
  • 169
  • 1
  • 2
  • 9
1
vote
0 answers

Looking up .class-files via Classloader.getResource() on Android

I am trying to build an Android application which uses the XMLBeans library. The library tries to look up .class-files via ClassLoader cl = SchemaDocument.class.getClassLoader(); URL resource = cl.getResource("xyz.class"); It seems this does not…
centic
  • 15,565
  • 9
  • 68
  • 125
1
vote
0 answers

Permissions needed for code downloaded after app install

Android's developer documentation requires listing the permissions needed for an app in the AndroidManifest.xml file. My question relates to the situation when I want provide an updated feature to the app, not via app store update, but via…
Jake
  • 16,329
  • 50
  • 126
  • 202
1
vote
0 answers

"ClassNotFound" Exception while dynamically loading .dex file in Android

I am trying to learn dynamically loading classes (.dex/.jar) in Android. I assembled the basic ideas from tutorials and Stack Overflow questions (tutorial, this, and this), but I am failing to fulfill my purpose of dynamically loading class files…
node_analyser
  • 1,502
  • 3
  • 17
  • 34