dex

插件化---类加载(一)

北城以北 提交于 2020-01-09 12:12:25
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 最近在学插件化,看的各种脑阔疼,现在随手写点笔记,方便以后回顾, 有理解不对的地方,请指出 加载类都是通过类加载器ClassLoader来实现的,其实类加载器还有几个,关系就如下 pathClassLoader可以理解为是加载自己写的activity,如TestActivity extends Activity,这时候在TestActivity中onCreat中直接getClassLoader这时候打印出来就是 pathClassLoader DexClassLoader可以理解为是加载系统类的,如android.app.activity下的类 先手绘了张类加载的流程,有点乱,凑活看吧,按照自己理解来画的 这里主要的就是双亲委托机制,好处就是安全,防止重复加载, 首先加载一个类的时候,调用loadClass方法,在loadClass方法中首先调用findloadedclass()方法,从已经加载的类中找,找到就直接返回,找不到就调用parent的loadClass方法,这里的parent不是父类,是上一级的意思,在上一级中依旧是findloadedclass(),通过不断递归,一直找到最上级BootClassLoader,它里面没有findloadedclass后就加载自身的findclass

Execution failed for task : app:dexDebug

感情迁移 提交于 2020-01-06 19:52:48
问题 When I am running my android project I got the following error:: Error:Execution failed for task ':app:dexDebug'. com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.7.0_80\bin\java.exe'' finished with non-zero exit value 3 I tried Build->Clean Project but in vain.Alos i tried "Sync project with gradle files" but in vain .My build.gradle file is : apply plugin: 'com.android.application' android {

Error converting bytecode to dex: Multiple dex files, Android Studio 3.0

早过忘川 提交于 2020-01-06 06:55:53
问题 I recently upgraded to Android Studio 3.0, and while running the program I get the following error: Error:Error converting bytecode to dex: Cause: com.android.dex.DexException: Multiple dex files define Lcom/vuforia/TransformModel; Error:com.android.dex.DexException: Multiple dex files define Lcom/vuforia/TransformModel; Error: at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:661) Error: at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:616) Error: at com

ClassNotFoundException - Unable to instantiate BroadcastReceiver

被刻印的时光 ゝ 提交于 2020-01-05 08:03:33
问题 I have a Broadcastreceiver which checks for CONNECTIVITY_CHANGE and it crashes sometimes with message: 04-05 18:23:47.080 5561-5561/tenkol.design.com.imbrecords E/AndroidRuntime﹕ FATAL EXCEPTION: main java.lang.RuntimeException: Unable to instantiate receiver tenkol.design.com.imbrecords.NetworkChangeReceiver: java.lang.ClassNotFoundException: tenkol.design.com.imbrecords.NetworkChangeReceiver at android.app.ActivityThread.handleReceiver(ActivityThread.java:2541) at android.app.ActivityThread

Android app slow initial startup time

流过昼夜 提交于 2020-01-03 15:21:22
问题 After I started using UI elements from the android support design library the app initial load time has become really slow (about 8 seconds!) and I am really not sure why. I ran method tracking during most of the startup (It takes time for android studio to start running the cpu monitor) and found it spend 4 seconds on: dalvik.system.DexFile.openDexFile , Im not sure why this is taking so long. Any ideas? (I didnt add any code since there is a lot of code in my app and I dont know where the

Tried to reverse engineer my app, but got some weird-looking file tree

匆匆过客 提交于 2020-01-01 19:28:17
问题 I lost the code from all the apps I built last year (thunder against my hard disk, no backup for any app). As they were rather simple apps, I put them under reverse engineering process. I have already done this a dozens of time in the past, each time I had no problems at all (if we do not count hours of work to put together all the files into a single project). I have already finished 3 apps I lost during hard disk burnout. They were reversed almost flawlessly, but I got stuck with this one.

Multiple dex files define Landroid/support/v7/util/ThreadUtil$MainThreadCallback Error

独自空忆成欢 提交于 2019-12-31 05:40:09
问题 Error occurs only when I'm trying to take release or debug apk of my app. I can run or debug it on my device straight from Android Studio. From this question, I understood that this might be due to duplicate dependencies. So I tried to check whether there are any duplicate dependencies by running: ./gradlew -q :app:dependencies I got the following dependency tree: _releaseApk - ## Internal use, do not manually configure ## +--- com.android.support:appcompat-v7:25.3.1 | +--- com.android

Android 64k method limit error on 56k methods

不问归期 提交于 2019-12-30 07:31:30
问题 I'm receiving this error in my android project: Unable to execute dex: method ID not in [0, 0xffff]: 65536 Conversion to Dalvik format failed: Unable to execute dex: method ID not in [0, 0xffff]: 65536 From all my research it's due to having too many methods in my android project - limit is 64k. However I have run scripts to count how many is currently in the project and it is coming up with 56k methods. Here is the script I am running. The only addition to my project is that I have updated

Android 64k method limit error on 56k methods

╄→гoц情女王★ 提交于 2019-12-30 07:30:32
问题 I'm receiving this error in my android project: Unable to execute dex: method ID not in [0, 0xffff]: 65536 Conversion to Dalvik format failed: Unable to execute dex: method ID not in [0, 0xffff]: 65536 From all my research it's due to having too many methods in my android project - limit is 64k. However I have run scripts to count how many is currently in the project and it is coming up with 56k methods. Here is the script I am running. The only addition to my project is that I have updated

Android: Compilation error with v7 support lib 27.1.0 “Program type already present” android.support.v7.recyclerview.extensions.ListAdapter

喜夏-厌秋 提交于 2019-12-29 07:32:27
问题 I think there must be a bug with the 27.1.0 v7 support lib, just released. After updating my project to use it (from 26.1.0), I keep getting this compilation error: Task :app:transformDexArchiveWithDexMergerForRegularDebug FAILED D8 is used to merge dex. Program type already present: android.support.v7.recyclerview.extensions.ListAdapter FAILURE: Build failed with an exception. What went wrong: Execution failed for task ':app:transformDexArchiveWithDexMergerForRegularDebug'. com.android.build