Baksmali error for android odex file - java

I downloaded core.odex and framework.odex from my Samsung Galaxy Player, in order to make some changes for the hidden apis, following this webpage: https://devmaze.wordpress.com/2011/01/18/using-com-android-internal-part-2-hacking-around/
Also, I got baksmali and smali from here: http://forum.xda-developers.com/showthread.php?t=1650243
Now, when I run the command: java -jar baksmali-1.3.3.jar -c :core.odex -x framework.odex, the following error appears:
UNEXPECTED TOP-LEVEL EXCEPTION:
org.jf.dexlib.Util.ExceptionWithContext: regCount does not match the number of arguments of the method
at org.jf.dexlib.Util.ExceptionWithContext.withContext(ExceptionWithContext.java:54)
at org.jf.dexlib.Code.InstructionIterator.IterateInstructions(InstructionIterator.java:92)
at org.jf.dexlib.CodeItem.readItem(CodeItem.java:154)
at org.jf.dexlib.Item.readFrom(Item.java:76)
at org.jf.dexlib.OffsettedSection.readItems(OffsettedSection.java:48)
at org.jf.dexlib.Section.readFrom(Section.java:143)
at org.jf.dexlib.DexFile.<init>(DexFile.java:431)
at org.jf.baksmali.main.main(main.java:265)
Caused by: java.lang.RuntimeException: regCount does not match the number of arguments of the method
at org.jf.dexlib.Code.Format.Instruction3rc.checkItem(Instruction3rc.java:129)
at org.jf.dexlib.Code.Format.Instruction3rc.<init>(Instruction3rc.java:79)
at org.jf.dexlib.Code.Format.Instruction3rc.<init>(Instruction3rc.java:44)
at org.jf.dexlib.Code.Format.Instruction3rc$Factory.makeInstruction(Instruction3rc.java:145)
at org.jf.dexlib.Code.InstructionIterator.IterateInstructions(InstructionIterator.java:84)
... 6 more
Error occured at code address 0
code_item #0x159a90
What am I missing or doing wrong?
Appreciate in advance any help you can provide.

Related

Error while emitting RecordedSimulation in Gatling Tool

Getting below error when I am trying to run gatling.sh file. From my understanding getting compilation issue in RecorderSimulation.scala file while doing gatling.sh. Please see the below Error and help me
JAVA = "java"
11:51:37.496 [ERROR] i.g.c.ZincCompiler$ - Error while emitting
RecordedSimulation
Method too large: RecordedSimulation.<init> ()V
11:51:37.520 [ERROR] i.g.c.ZincCompiler$ - one error found
11:51:37.531 [ERROR] i.g.c.ZincCompiler$ - Compilation crashed
sbt.internal.inc.CompileFailed: null
at sbt.internal.inc.AnalyzingCompiler.compile(AnalyzingCompiler.scala:122)
at sbt.internal.inc.AnalyzingCompiler.compile(AnalyzingCompiler.scala:95)
at sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$4(MixedAnalyzingCompiler.scala:91)
at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
at sbt.internal.inc.MixedAnalyzingCompiler.timed(MixedAnalyzingCompiler.scala:186)
at sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$3(MixedAnalyzingCompiler.scala:82)
at sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$3$adapted(MixedAnalyzingCompiler.scala:77)
at sbt.internal.inc.JarUtils$.withPreviousJar(JarUtils.scala:215)
at sbt.internal.inc.MixedAnalyzingCompiler.compileScala$1(MixedAnalyzingCompiler.scala:77)
at sbt.internal.inc.MixedAnalyzingCompiler.compile(MixedAnalyzingCompiler.scala:146)
at sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1(IncrementalCompilerImpl.scala:343)
at sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1$adapted(IncrementalCompilerImpl.scala:343)
at sbt.internal.inc.Incremental$.doCompile(Incremental.scala:120)
at sbt.internal.inc.Incremental$.$anonfun$compile$4(Incremental.scala:100)
at sbt.internal.inc.IncrementalCommon.recompileClasses(IncrementalCommon.scala:180)
at sbt.internal.inc.IncrementalCommon.cycle(IncrementalCommon.scala:98)
at sbt.internal.inc.Incremental$.$anonfun$compile$3(Incremental.scala:102)
at sbt.internal.inc.Incremental$.manageClassfiles(Incremental.scala:155)
at sbt.internal.inc.Incremental$.compile(Incremental.scala:92)
at sbt.internal.inc.IncrementalCompile$.apply(Compile.scala:75)
at sbt.internal.inc.IncrementalCompilerImpl.compileInternal(IncrementalCompilerImpl.scala:348)
at sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileIncrementally$1(IncrementalCompilerImpl.scala:301)
at sbt.internal.inc.IncrementalCompilerImpl.handleCompilationError(IncrementalCompilerImpl.scala:168)
at sbt.internal.inc.IncrementalCompilerImpl.compileIncrementally(IncrementalCompilerImpl.scala:248)
at sbt.internal.inc.IncrementalCompilerImpl.compile(IncrementalCompilerImpl.scala:74) at io.gatling.compiler.ZincCompiler$.doCompile(ZincCompiler.scala:211)
at io.gatling.compiler.ZincCompiler$.delayedEndpoint$io$gatling$compiler$ZincCompiler$1(ZincCompiler.scala:216)
at io.gatling.compiler.ZincCompiler$delayedInit$body.apply(ZincCompiler.scala:39)
at scala.Function0.apply$mcV$sp(Function0.scala:39)
at scala.Function0.apply$mcV$sp$(Function0.scala:39)
at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:17)
at scala.App.$anonfun$main$1$adapted(App.scala:80)
at scala.collection.immutable.List.foreach(List.scala:392)
at scala.App.main(App.scala:80)
at scala.App.main$(App.scala:78)
at io.gatling.compiler.ZincCompiler$.main(ZincCompiler.scala:39)
at io.gatling.compiler.ZincCompiler.main(ZincCompiler.scala)
Choose a simulation number:
[0] computerdatabase.BasicSimulation
[1] computerdatabase.advanced.AdvancedSimulationStep01
[2] computerdatabase.advanced.AdvancedSimulationStep02
[3] computerdatabase.advanced.AdvancedSimulationStep03
[4] computerdatabase.advanced.AdvancedSimulationStep04
Please suggest solution
This error is due to the size of the scala file being too large. You need to keep number of requests in a method to under 100. I faced the same issue and resolved it by splitting the script into two methods.
You've managed to generate some piece of code that's too large with regard to the Scala language spec.
Please make sure you're using latest Gatling version (3.3.1 as of now) and upgrade if not.
If problem still happens, please reach out on Gatling community mailing list and provide your code.

dex2jar error: handleHotSwapPatch + FragmentManagerImpl

I tried to access codes of my deleted app by apk got from emulator. I accessed classes.dex but there is a problem making it jar by dex2jar. This is really important for me, how to fix that?
The error file below:
Summary
version: reader-1.15, translator-0.0.9.15, ir-1.12
there are 2 error methods
options: -d
t0.txt
java.lang.NullPointerException
at com.googlecode.dex2jar.ir.ts.LocalSplit.transform(LocalSplit.java:255)
at com.googlecode.dex2jar.v3.V3MethodAdapter.visitEnd(V3MethodAdapter.java:215)
at com.googlecode.dex2jar.v3.V3ClassAdapter$2.visitEnd(V3ClassAdapter.java:320)
at com.googlecode.dex2jar.reader.DexFileReader.acceptMethod(DexFileReader.java:691)
at com.googlecode.dex2jar.reader.DexFileReader.acceptClass(DexFileReader.java:436)
at com.googlecode.dex2jar.reader.DexFileReader.accept(DexFileReader.java:323)
at com.googlecode.dex2jar.v3.Dex2jar.doTranslate(Dex2jar.java:85)
at com.googlecode.dex2jar.v3.Dex2jar.to(Dex2jar.java:261)
at com.googlecode.dex2jar.v3.Dex2jar.to(Dex2jar.java:252)
at com.googlecode.dex2jar.tools.Dex2jarCmd.doCommandLine(Dex2jarCmd.java:110)
at com.googlecode.dex2jar.tools.BaseCmd.doMain(BaseCmd.java:174)
at com.googlecode.dex2jar.tools.Dex2jarCmd.main(Dex2jarCmd.java:34)
DexMethodVisitor mv=cv.visitMethod(ACC_PRIVATE, new Method("Lcom/android/tools/fd/runtime/Server;","handleHotSwapPatch",new String[]{ "I","Lcom/android/tools/fd/runtime/ApplicationPatch;"},"I"));
t1.txt
java.lang.NullPointerException
at com.googlecode.dex2jar.ir.ts.LocalSplit.transform(LocalSplit.java:255)
at com.googlecode.dex2jar.v3.V3MethodAdapter.visitEnd(V3MethodAdapter.java:215)
at com.googlecode.dex2jar.v3.V3ClassAdapter$2.visitEnd(V3ClassAdapter.java:320)
at com.googlecode.dex2jar.reader.DexFileReader.acceptMethod(DexFileReader.java:691)
at com.googlecode.dex2jar.reader.DexFileReader.acceptClass(DexFileReader.java:441)
at com.googlecode.dex2jar.reader.DexFileReader.accept(DexFileReader.java:323)
at com.googlecode.dex2jar.v3.Dex2jar.doTranslate(Dex2jar.java:85)
at com.googlecode.dex2jar.v3.Dex2jar.to(Dex2jar.java:261)
at com.googlecode.dex2jar.v3.Dex2jar.to(Dex2jar.java:252)
at com.googlecode.dex2jar.tools.Dex2jarCmd.doCommandLine(Dex2jarCmd.java:110)
at com.googlecode.dex2jar.tools.BaseCmd.doMain(BaseCmd.java:174)
at com.googlecode.dex2jar.tools.Dex2jarCmd.main(Dex2jarCmd.java:34)
DexMethodVisitor mv=cv.visitMethod(ACC_PUBLIC, new Method("Landroid/support/v4/app/FragmentManagerImpl;","allocBackStackIndex",new String[]{ "Landroid/support/v4/app/BackStackRecord;"},"I"));
addition: I got the apk from installed project by pull command and it doesnt signed. Normally, I have not even seen this error with signed apks.

Viewing a Compiler error output

I am new to Netbeans and I am given a simple exercise by my professor to find the compiler errors in a given program. This is a simple hello world program but all I get is
Compiling 1 source file to D:\UCC\CS6312-Mobile Devices and Systems\Lab\MyFirstMIDlet\build\compiled
D:\UCC\CS6312-Mobile Devices and Systems\Lab\MyFirstMIDlet\src\myfirstmidlet\MyFirstMIDlet.java:12: error: ';' expected
form.addCommand(exit)
1 error
D:\UCC\CS6312-Mobile Devices and Systems\Lab\MyFirstMIDlet\nbproject\build-impl.xml:359: Compile failed; **see the compiler error output for details.**
BUILD FAILED (total time: 0 seconds)
So I want to know where I can find the details of the compiler errors as I have to include those in my assignment. Thank you
The compile error is the first bit of the error message:
D:\UCC\CS6312-Mobile Devices and Systems\Lab\MyFirstMIDlet\src\myfirstmidlet\MyFirstMIDlet.java:12: error: ';' expected
form.addCommand(exit)
This could mean exactly what it says, and that you're missing a semicolon on this line, but doesn't necessarily - it might be something else that's wrong that's causing the compiler to produce that error. You may also run into the case where you fix that error then have to fix some others that come up afterwards - such is the nature of compilers!

JavaClassFormat exception [duplicate]

I am getting this strange error while executing the following code.
EncoderRequest encoderRequest = new EncoderRequest(sid,appTxnId,pfid,transactionType,"",isUpdatetype9,true);
I have checked all the parameter values are valid. I am using java7 plateform.
can any one have come across this situation, please help.
following is the part of stacktrace i am getting.
Caused by: java.lang.ClassFormatError: Illegal local variable table length 48 in method com.cmc.facts.encoder.EncoderRequest.<init>(JLjava/lang/String;Ljava/lang/Long;Lcom/cmc/facts/enums/TransactionType;Ljava/lang/String;ZZ)V at com.cmc.facts.nist.NistReaderModel.preprossingOfNistFile(NistReaderModel.java:180) at com.cmc.facts.action.interstate.InterStateAction.uploadFIIF(InterStateAction.java:645) ... 115 more
There have been previous reports of the same error, on Junit tests and similar..
For them, adding the JVM arg -XX:-UseSplitVerifier seemed to work
Have a look at this article
You can also do this config :
Add -noverify in your jvg args
For ant config you can do : <jvmarg value="-noverify"/>
You can follow the link for more details on why we need to do this.

YUICompressor crashes - stackoverflow error

I frequently get what appears to be a stackoverflow error ;-) from YUICompressor. The following is the first part of thousands of error lines that come from attempting to compress a 24074 byte css stylesheet (not the "Caused by java.lang.StackOverflowError about 8 lines down):
iMac1:src jas$ min ../style2.min.css style2.css
Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.yahoo.platform.yui.compressor.Bootstrap.main(Bootstrap.java:21)
Caused by: java.lang.StackOverflowError
at java.lang.Character.codePointAt(Character.java:2335)
at java.util.regex.Pattern$CharProperty.match(Pattern.java:3344)
at java.util.regex.Pattern$Branch.match(Pattern.java:4114)
... (plus 1021 more error lines)
The errors happen usually after adding a couple of lines to the file getting compressed. The css is fine, and works perfectly in the uncompressed format. I don't see a particular pattern to the types of selectors added to the file that cause the errors. In this case, adding the following selector to a previously compressible file resulted in the errors:
#thisisatest
{
margin-left:87px;
}
I am wondering if there is perhaps a flag to java to enlarge the stack that might help. Or if that is not the problem, what is?
EDIT:
As I was posting this question, it dawned on me that I should check the java command to see if there was a parameter to enlarge the stack. Turns out that it is -Xssn, where "n" is a parameter to indicate the stack size. Its default value is 512k. So I tried 1024k but that still led to the stackoverflow. Trying 2048k works however, and I think this could be the solution.
EDIT 2:
While I no longer use this method for minification any longer, to be more specific here is the full command (which I have set up as a shell alias), showing how the -Xss2048k parameter is used:
java -Xss2048k -jar ~/Documents/RepHunter/Website\ Materials/Code/Third\ Party\ Libraries/YUI\ Compressor/yuicompressor-2.4.8.jar --type css -o
As posted in my edit, the solution was to add the parameters to the java command. The clue was the error line at the 5-th "at" line, as follows:
at com.yahoo.platform.yui.compressor.Bootstrap.main(Bootstrap.java:21)
Caused by: java.lang.StackOverflowError
Seeing that the issue was a "StackOverlowError" ;-) gave the suggestion to try to increase the stack size. The default is 512k. My first try of 1024k did not work. However increasing it to 2048k did work, and I have had no further issues.

Categories

Resources