gpt4 book ai didi

java - 将 .java 转换为 .smali

转载 作者:行者123 更新时间:2023-11-29 23:05:13 24 4
gpt4 key购买 nike

如标题中所述,我正在尝试将 java 文件转换为 .smali 文件,因此这些是我试图从 Android studio 终端启动的命令:

javac HelloWorld.java

dx --dex --output=classes.dex HelloWorld.class

bakmali classes.dex

但是当我启动第二个命令时,我得到了这个错误:

bash: dx : command not found

此外,我尝试通过以下方式将我的文件直接编译为 smali,方法是:Build/compile to smali on Android studio,这是我得到的错误:

Error:Internal error: (java.lang.ClassNotFoundException) com.google.wireless.android.sdk.stats.IntellijIndexingStats$Index java.lang.ClassNotFoundException: com.google.wireless.android.sdk.stats.IntellijIndexingStats$Index> at java.net.URLClassLoader.findClass(URLClassLoader.java:381) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) at com.intellij.util.indexing.counters.IndexCounters.(IndexCounters.java:34) at com.intellij.util.indexing.impl.MapReduceIndex.(MapReduceIndex.java:86) at org.jetbrains.jps.backwardRefs.index.CompilerReferenceIndex$CompilerMapReduceIndex.(CompilerReferenceIndex.java:214) at org.jetbrains.jps.backwardRefs.index.CompilerReferenceIndex.(CompilerReferenceIndex.java:73) at org.jetbrains.jps.backwardRefs.JavaCompilerBackwardReferenceIndex.(JavaCompilerBackwardReferenceIndex.java:12) at org.jetbrains.jps.backwardRefs.JavaBackwardReferenceIndexWriter.initialize(JavaBackwardReferenceIndexWriter.java:74) at org.jetbrains.jps.backwardRefs.JavaBackwardReferenceIndexBuilder.buildStarted(JavaBackwardReferenceIndexBuilder.java:40) at org.jetbrains.jps.incremental.IncProjectBuilder.runBuild(IncProjectBuilder.java:358) at org.jetbrains.jps.incremental.IncProjectBuilder.build(IncProjectBuilder.java:178) at org.jetbrains.jps.cmdline.BuildRunner.runBuild(BuildRunner.java:138) at org.jetbrains.jps.cmdline.BuildSession.runBuild(BuildSession.java:302) at org.jetbrains.jps.cmdline.BuildSession.run(BuildSession.java:135) at org.jetbrains.jps.cmdline.BuildMain$MyMessageHandler.lambda$channelRead0$0(BuildMain.java:229) at org.jetbrains.jps.service.impl.SharedThreadPoolImpl.lambda$executeOnPooledThread$0(SharedThreadPoolImpl.java:42) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745)

关于如何使这项工作有任何想法吗?或任何其他将 .java 转换为 .smali 的工具?

最佳答案

这对我有用:

我只需要在 Linux 上找到位于 ~/Android/Sdk/build-tools/$version 的命令 dx,但首先要确保 android-sdk 已安装(在 Linux 上通常位于 ~/android/sdk 中)然后使用

运行 dx

./dx --dex --output=classes.dex path_to_source_file.class 如果您与 dx

在同一目录中

关于java - 将 .java 转换为 .smali,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56631461/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com