新手发帖,很多方面都是刚入门,有错误的地方请大家见谅,欢迎批评指正
如何处理apktool d -d 出现错误Error occured while disassembling class
告诉你,这不是你的错误,这是apktool本身的错误,现在正式release的1.5.2版本不行,搞不定这个问题,你需要应用1.5.3的应用版本。
需要去google网站现在这个程序然后编译
# Build I was able to build on Linux (gentoo, amd64, java version "1.7.0_13", javac 1.7.0_13) using the following steps:
1) git clone https://code.google.com/p/android-apktool/
2) cd android-apktool/
3) ./gradlew
4) ./gradlew fatJar
# Run
java -jar brut.apktool/apktool-cli/build/libs/apktool-cli-1.5.3-SNAPSHOT.jar
不好意思,悲哀的告诉你,我们非常光彩准确的党已阻挡了这个万恶的资本主义社会美国这个技术网站。怎么办,FQ吧,或者找一个别人已编译好的。
当然,你可能还会犯错,请看上面的处理方法:
Installing javac for Apktool on linux
The build steps of the latest Apktool is detailed below
http://code.google.com/p/android-apktool/wiki/BuildApktool?tm=4
It uses something called gradlew to build the latest version of the binary.
The instructions are as follows:
We use gradle to build. Its pretty easy. First clone the REPO. git clone git://github.com/iBotPeaches/Apktool.git Move into the directory. cd Apktool Issue the build. ./gradlew build Then look in /brut.apktool/apktool-cli/build/libs/apktool-xxxxx.jar Other commands such as clean are ./gradlew clean
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
We use gradle to build. Its pretty easy. First clone the REPO.
git clone git://github.com/iBotPeaches/Apktool.git
Move into the directory.
cd Apktool
Issue the build.
./gradlew build
Then look in
/brut.apktool/apktool-cli/build/libs/apktool-xxxxx.jar
Other commands such as clean are
./gradlew clean
If you attempt that and dont have JDK installed, it will error out.
You need to download the latest version of the JDK available as a .tar.gz file at http://www.oracle.com/technetwork/java/javase/downloads/index.html
I used jdk-7u9-linux-i586.tar.gz
Once extracted, set the path as the path of the folder containing the bin folder (which contains javac). Note that the path should be the parent of the bin folder, and not include the bin folder itself.
export JAVA_HOME=/home/droidzone/android/java/jdk1.7.0_09
1
export JAVA_HOME=/home/droidzone/android/java/jdk1.7.0_09
Here, jdk1.7.0_09/bin contains javac.
The final file will be produced in a location brut.apktool/apktool-cli/build/libs/ relative to the parent and named of the form apktool-cli-1.5.1-SNAPSHOT.jar
So
cp brut.apktool/apktool-cli/build/libs/*jar ./
1
cp brut.apktool/apktool-cli/build/libs/*jar ./
should get you the latest file.
Note that you need the wrapper too.
wget http://android-apktool.googlecode.com/files/apktool-install-linux-r04-brut1.tar.bz2 tar -jxvvf apktool-install-linux-r04-brut1.tar.bz2
1
2
wget http://android-apktool.googlecode.com/files/apktool-install-linux-r04-brut1.tar.bz2
tar -jxvvf apktool-install-linux-r04-brut1.tar.bz2
Finally since the apktool refers to a file named apktool.jar, create a symlink.
Possible errors:
Exception in thread "main" java.lang.UnsupportedClassVersionError: brut/apktool/Main : Unsupported major.minor version 51.0 at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:634) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at java.net.URLClassLoader.defineClass(URLClassLoader.java:277) at java.net.URLClassLoader.access$000(URLClassLoader.java:73) at java.net.URLClassLoader$1.run(URLClassLoader.java:212) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:205) at java.lang.ClassLoader.loadClass(ClassLoader.java:321) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294) at java.lang.ClassLoader.loadClass(ClassLoader.java:266) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:334) Could not find the main class: brut.apktool.Main. Program will exit.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
Exception in thread "main" java.lang.UnsupportedClassVersionError: brut/apktool/Main : Unsupported major.minor version 51.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:634)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:277)
at java.net.URLClassLoader.access$000(URLClassLoader.java:73)
at java.net.URLClassLoader$1.run(URLClassLoader.java:212)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:334)
Could not find the main class: brut.apktool.Main. Program will exit.
That happens when your main system version java is older than version 7.
You can solve it either by:
1. Upgrading your main java version
2. Setting the PATH of your local java to override your system java.
Eg: If PATH is :/usr/bin:~/bin, make it ~/bin:/usr/bin
3. Creating a symlink in /usr/bin, point it to your version
cd /usr/bin su mv java java.old ln -s /home/droidzone/android/java/jdk1.7.0_09/bin/java java
1
2
3
4
5
6
7
cd /usr/bin
su
mv java java.old
ln -s /home/droidzone/android/java/jdk1.7.0_09/bin/java java
文章结束给大家分享下程序员的一些笑话语录:
自从有了Photoshop,我再也不相信照片了!(没有Photoshop的年代,胶片照片年代做假的也不少,那时候都相信假的!)