1.In the past two days, I tried to create an ant APK. When I signed the APK, I found that the signature was successful, but I was prompted that there was no digital certificate during installation.
My colleague's machine can be installed normally after signing, but it cannot be installed on my machine. Finally, I found that my colleague's JDK version 1.6 is 1.7.
Finally, I checked the information on the Internet to solve the problem. When signing, I added two parameters after the jarsigner command:
-Digestalg sha1
-Sigalg md5withrsa
Use ant as follows:
<target name="jarsigner" depends="package" > <exec executable="${jarsigner}" failonerror="true" > <arg value="-verbose" /> <arg value="-digestalg" /> <arg value="SHA1" /> <arg value="-sigalg" /> <arg value="MD5withRSA" /> <arg value="-keystore" /> <arg value="${key.store}" /> <arg value="-storepass" /> <arg value="${key.store.password}" /> <arg value="-keypass" /> <arg value="${key.alias.password}" /> <arg value="-signedjar" /> <arg value="${out-signed-package-ospath}" /> <arg value="${out-unsigned-package-ospath}" /> <arg value="${key.alias}" /> </exec></target>
2.After packaging, we found that after manually compiling the class, after hitting the DEX file, we will find that there are fewer class files in this Dex, which is hard to understand,
Eclipse automatically compiled packages are normal. Why can't I execute my own compile? No exception was found during multi-party comparison.
My colleagues printed the log and noticed that there were many "bad class file magic (cafebabe) or version (0033.0000)" prompts in the log. Later on the Internet
This problem is also encountered by colleagues. It is caused by the JDK version. After JDK 1.7 is compiled, it will appear. If you encounter this problem, you can change to JDK 1.6.
3.Note:
I used ant to play APK. After hitting it, it will be due to notfoundclassexception during runtime. After tracking, I found that the package path cannot be directly written as a folder. As follows:
Change <Arg value = "$ {outdir-classes-ospath}"/> to <Arg value = "$ {outdir-classes-ospath }/*"
/>. Otherwise, the class file may not be actually typed into the DEX package.
<! -- Set. class file. dex file --> <target name = "Dex" depends = "proguard"> <echo> converting compiled files and external libraries into. dex file... </echo> <exec executable = "$ {DX}" failonerror = "true"> <Arg value = "-- Dex"/> <Arg value = "-- verbose"/> <! -- Output file --> <Arg value = "-- output =$ {Dex-ospath}"/> <! -- Source classes and libraries of the. Dex file to be generated --> <Arg value = "$ {outdir-classes-ospath}/*"/> <! -- Note: $ {outdir-classes-ospath} ", the notfoundclassexception will be thrown during runtime, the class under the suspected directory cannot enter DEX --> <Arg value = "$ {external-Lib-ospath}"/> </exec> </Target>