eclipse fails to "build workspace" on large android files...? - java

i have a severe problem with eclipse, where i need to compile a somewhat larger class. by "larger" i mean, the class has about 5000 lines of code...
problem is that on saving this project, eclipse takes several seconds (30-40) to "build the workspace". to be exact, it says "50%" and keeps saying that for 30-40 seconds. then, it breaks with the following error:
[console]:
[2010-07-09 15:28:39 - Dex Loader] Unable to execute dex: null
[2010-07-09 15:28:39 - myProject] Conversion to Dalvik format failed: Unable to execute dex: null
[problems window]:
Conversion to Dalvik format failed: Unable to execute dex: null
this error is reproducible and keeps popping up until i comment out several thousands LOC, so that the file still has this 5k LOC, but ~2000 of them are comments. THEN it works...
i know that 5000 LOC are no really good programming style, but i need to do it this way for now ... (i have to write this much records to a sqlite database and since sqlite doesnt feature multiple sql-queries in one rawQuery-command i have to execute a single rawQuery() for each and every data record i need to push into the db.... - until i write a file reader to read this data from a file (that needs verification etc)), i'm stuck with this solution...)
how do i get eclipse and the android sdk to accept files this big?
(system: ubuntu 10.04 x86, eclipse 3.6)

I believe the size of a class's bytecode must not exceed 64k in Dalvik. You'll have to split the class into smaller ones.

Related

Mojo Scoring Java Error using h2o.mojo_predict_df

I have used H2O for about a year now to build and score models but have never used MOJO to do this. This is something I am currently wanting to do and I came across the function h2o.mojo_predict_df to score out my models which will drastically increase runtime as well as allowing me to update my h2o without the worry of my models not scoring in a later version of h2o.
So I have downloaded my .zip from MOJO and corresponding .jar file, let's say they sit in the folder
C:\Folder\Test\Model.zip
C:\Folder\Test\h2o-genmodel.jar
Now am I trying to run it through, lets say my R data frame is called Data then I am using:
h2o.mojo_predict_df(frame = Data,
mojo_zip_path = "C:/Folder/Test/Model.zip",
genmodel_jar_path = "C:/Folder/Test/h2o-genmodel.jar")
However, this produces the error:
Error in safeSystem(cmd_str): SYSTEM COMMAND FAILED (exit status 127).
I am not quite sure what this is. My experience is java is limited. I tried on a different machine and got a completely different error:
"Error: Could not create a Java Virtual Machine".
Error: A fatal exception has occurred. The program will exit.
Unrecognised option : - 1.
Error in safeSystem(cmd_str) : SYSTEM COMMAND FAILED (exit status 1).
I'm not sure why they got different errors. The code ran was exactly the same.
Any help would be appreciated!
As nathan mentioned in the comments the error is due to a bug in Stacked Ensemble Mojo which can be tracked here: 0xdata.atlassian.net/browse/PUBDEV-6026

Android WireApp logs UnsatisfiedLink error: "wcall_set_video_send_state" when attempting video calls

I've built the wire app from the following repository:
https://github.com/wireapp/wire-android
Using the following build directions:
How to build locally Check out the wire-android repository. Switch to
latest relase branch release From the checkout folder, run ./gradlew
assembleProdRelease. This will pull in all the necessary dependencies
from Maven.
I've tried the release branch:
git clone https://github.com/wireapp/wire-android.git --branch release
And the master:
git clone https://github.com/wireapp/wire-android.git
Initially both versions gave the error:
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
at java.lang.Thread.run(Thread.java:764)
Caused by: java.lang.UnsatisfiedLinkError: Error looking up function 'wcall_set_video_send_state': undefined symbol: wcall_set_video_send_state
at com.sun.jna.Function.<init>(Function.java:245)
at com.sun.jna.NativeLibrary.getFunction(NativeLibrary.java:566)
However, this error can be solved by running the following command prior to opening the project in Android Studio:
gradlew assembleProdRelease
This command also creates the apks in build/output/apks. However, the build isn't signed with either the release or debug key. I used the following tool to sign the apk:
https://github.com/patrickfav/uber-apk-signer/releases
The APK is stable and runs fine, but still cannot initiate a video call. It gives the following errors:
Android 5:
08-24 22:53:29.877 296-881/? E/FastThread: did not receive expected
priority boost
Android 8:
08-24 23:10:02.190 406-4592/? E/AudioALSAPlaybackHandlerBase:
-getHardwareBufferInfo(), pcm_get_htimestamp fail, ret = -1, pcm_get_error =
Android 9 Emulator:
08-25 19:56:58.425 1583-3268/? W/audio_hw_generic: Not supplying
enough data to HAL, expected position 4108693 , only wrote 4108320
UPDATE:
I thought about trying to build my own versions of the AVS libraries: following https://github.com/wireapp/wire-audio-video-signaling
The following command needs to be run:
make dist_android
C:\work\wire-audio-video-signaling>make dist-android mk/target.mk:167:
*** Unknown host system. Stop.
mk/target.mk looks like:
# Start by auto-determining host system and arch.
ifeq ($(HOST_OS),)
HOST_UNAME := $(shell uname)
ifeq ($(HOST_UNAME),Darwin)
HOST_OS := osx
else
ifeq ($(HOST_UNAME),Linux)
HOST_OS := linux
else
$(error Unknown host system)
endif
endif
endif
The Makefile doesn't seem to be setup to support Windows so I'm going to try building it from a Linux machine to see if that helps.
UPDATE 2:
It does build better on Ubuntu, but it eventually dies complaining about compiler arguments. [Sorry I don't have the error to hand]
But I've managed to find binary copies of the library built for Android/ARM here:
http://dl.bintray.com/wire-android/releases/com/wire/avs/
However, these libraries do not seem to solve the issue either.
UPDATE 3:
Tried the following:
Downloaded the latest version of the .aar file from the link above
Renamed it to avs.aar
Installed in app/libs
Uncommented the line: "implementation (name:'avs', ext:'aar')"
But I got the error:
Program type already present: com.waz.avs.VideoCapturer$4
Message{kind=ERROR, text=Program type already present:
com.waz.avs.VideoCapturer$4, sources=[Unknown source file], tool
name=Optional.of(D8)}
There is a another reference to the AVS library below, if you comment that out the error will go away.
However, none of these steps solve the problem.
Now I will try to build older versions of the release branch...
Update 4: Release Branch: 2.41.359
[The most recent non-beta tagged release]
No longer compiles in Android studio because some of the XML files in the layout DIR are not well formed. Those must be fixed and checked into Git since the build process checks all the files out from Git.
The app initially runs normally and allows login, but always crashes after the edit devices screen. The app then crashes every time that you try to open it.
08-25 14:51:02.142 29066-29109/? E/AndroidRuntime: FATAL EXCEPTION:
Thread-4
Process: com.wire, PID: 29066
java.lang.NullPointerException: Attempt to invoke interface method 'int com.waz.call.RequestHandler.request$1d4ff469()' on a null object
reference
at com.waz.call.FlowManager.request(FlowManager.java:365)
Note: Seems that edit devices screen is not the cause of the problem because I removed all my devices in the web app but then 2.41.359 crashes on the phone without displaying the edit devices screen.
This issue is mentioned in following threads:
https://github.com/wireapp/wire-android/issues/1271
https://github.com/wireapp/wire-android/issues/1288
The advice seems to be to use the avslib.so file from the production version since the provided one is inadequate to run the project.
So I've dowloaded the APK off their website:
https://wire.com/en/download/
It is version: 3.15.634 [That's older than the one in the app store: 3.16.638 though hopefully that doesn't matter].
For anyone that doesn't know, an APK is just a ZIP file so I renamed it to from .apk to .zip for purposes of obtaining libavs.so:
Root Dir:
Libs Dir:
Arm Dir:
With libavs.so extracted, I renamed the unsigned version of wire-prod-release-2.41.99999 produced by the build tools to wire-prod-release-2.41.99999-avs-mod.zip and deleted the old libavs.so and replaced it with the one that I just took from the production version of the app. I renamed it back to .pkg then ran the following command to sign it:
java -jar \uber-apk-signer-0.8.4.jar --apks wire-prod-release-2.41.99999-avs-mod.apk -debug
Pretty good result, 2.41.359 no longer crashes. However, I still cannot initiate any audio or video calls. Same error found in the latest version of the release branch:
08-25 16:01:51.748 406-4592/? E/AudioALSAPlaybackHandlerBase: -getHardwareBufferInfo(), pcm_get_htimestamp fail, ret = -1, pcm_get_error =
As a sanity check, I installed the production version: 3.15.634 used to extra libavs.so and it is able to make both audio and video calls. [The version on GooglePlay: 3.16.638 also works fine for audio and video...]
Any ideas?
After a few days of trying, I found a way to build the project in such a way that it will initiate audio and video calls:
Procedure:
git clone https://github.com/wireapp/wire-android.git --branch release
cd wire-android
git checkout 2.40.357
Load the project into Android Studio
Edit the file res/layout/collection_file_asset.xml
Move <?xml version="1.0" encoding="utf-8"?> above the copyright comment since the file must begin with the XML tag
git add .
git commit -m "fixed syntax error"
gradlew assembleProdRelease
java -jar \uber-apk-signer-0.8.4.jar --apks wire-prod-release-2.40.99999.apk -debug
adb install wire-prod-release-2.40.99999-aligned-debugSigned.apk
Other Notes:
Master currently does not build due to Scala errors...
The current release branch produces a stable app but results in the following error when tapping on the video icon: "E/AudioALSAPlaybackHandlerBase: -getHardwareBufferInfo(), pcm_get_htimestamp fail, ret = -1, pcm_get_error ="
The most recent stable release 2.41.359 does not work because it crashes on every app launch with: "AndroidRuntime: FATAL EXCEPTION: Thread-4 Process: com.wire, PID: 29066 java.lang.NullPointerException: Attempt to invoke interface method 'int com.waz.call.RequestHandler.request$1d4ff469()' on a null object reference at com.waz.call.FlowManager.request(FlowManager.java:365)"
While building 2.40.357 enables audio and video, it is unstable and crashes quite a bit while receiving and making calls. I've spoken with other developers using this code base and they've encountered similar problems...
Thoughts:
I'm not really sure what's happening with this project. There are developers pleading for help with audio / video issues on Git with little response. I think I'd feel a little uneasy about using this code for a commercial project unless there is a bit more stability and support...
I gave up to compile a working application from source. Aside from educational reasons, my motivation to compile from source was a particular code change (lifting the limit of simultaneous accounts in the android app, as I have more than 2)
Doing that change itself is trivial, its just a constant defined in
app/src/main/scala/com/waz/zclient/pages/main/profile/preferences/pages/ProfileBottomSheetDialog.scala:
val MaxAccountsCount = 2
However, since no working application can be built from the provided sources - even with considerable effort - I instead used the smali/backsmali tool from
https://github.com/JesusFreke/smali
to create a patch/diff of this particular code change between a modified and unmodified (nonfunctional) binary app built from source - reflecting the corresponding changes in bytecode. (Although apktool could probably be used to do the same)
This bytecode patch can then be applied to the precompiled and fully functional production app as well, also using smali/backsmali (or apktool)

How can I read IBM jit dump file

I want to look into the jitdump.20160505.165247.149.0004.dmp file.
Which is generated by IBM JVM 1.8 when it's crashing. Does anyone know how to read the dmp file?
I tried to use jextract to analyze it, but it complaints as following:
/opt/ibm/ibm-java-x86_64-80/jre/bin/jextract /tmp/jitdump.20160505.165247.149.0004.dmp -v
Loading dump file...
Error. Dump type not recognised, file: /tmp/jitdump.20160505.165247.149.0004.dmp
When trying to open jitdump file via MAT+DTFJ, here is the error message:
Error opening heap dump 'jitdump.20160505.165247.149.0004.dmp'. Check the error log for further details.
Unable to read dump C:\Users\IBM_ADMIN\Desktop\core_files\opt\ibm\apm\playback\selenium\jitdump.20160505.165247.149.0004.dmp metafile null in DTFJ format DTFJ-J9 (java.io.IOException)
Unable to read dump C:\Users\IBM_ADMIN\Desktop\core_files\opt\ibm\apm\playback\selenium\jitdump.20160505.165247.149.0004.dmp metafile null in DTFJ format DTFJ-J9
No Image sources were found for C:\Users\IBM_ADMIN\Desktop\core_files\opt\ibm\apm\playback\selenium\jitdump.20160505.165247.149.0004.dmp (java.io.IOException)
No Image sources were found for C:\Users\IBM_ADMIN\Desktop\core_files\opt\ibm\apm\playback\selenium\jitdump.20160505.165247.149.0004.dmp
The file is intended for IBM internal analysis only, the contents of the JIT dump files are not useful to anyone without an in depth understanding of the IBM JDK's JIT compiler internals. The existence of JIT dump file(s) does not imply that a JIT problem was encountered, the file was generated to collect data during a JVM crash so that if the crash is determined to be a JIT problem that IBM would stand a better chance of fixing the problem without having to ask for more data by recreating the problem several times.
You can try Eclipse MAT with IBM DTFJ plugin.

Why do I get: Unable to execute dex: Cannot merge new index 67124 into a non-jumbo instruction

This is as intelligently as I can ask this question right now. I am trying to compile my code and get the following error:
Unable to execute dex: Cannot merge new index 67124 into a non-jumbo instruction!
Conversion to Dalvik format failed: Unable to execute dex: Cannot merge new index 67124 into a non-jumbo instruction!
It started happening after I integrated PayPal sdk for payment. I see the error at my first attempt to test.
I already tried:
dex.force.jumbo=true
I got the same error and I was able to build after several steps. Here they are. Basically, your project is way too big for eclipse/android to handle so you have to A) increase the memory sizes and B) reduce the number of methods you have.
Increase Heap Size in eclipse.ini file.
How to find eclipse.ini file.
How do I increase the size of heap by editing eclipse.ini
I used the following values:
-Xms2048m
-Xmx2048m
That didn't really solve the problem so I followed the instructions in this link. Specifically:
Add the following
dex.force.jumbo=true
in the first line of project.properties
I then got this error: Unable to execute dex: method ID not in [0, 0xffff]: 65536
Which led me to another stack overflow answer here. I ended up deleting some .jars I didn't use anymore to reduce the number of methods my app uses.
I hope that helps!
I had similar error while compiling one of my android project in eclipse.
I played around all the settings and finally changing eclipse heap memory in eclipse.ini file had succeed.
Try to give as much as memory as possible to eclipse if you have enough RAM. My settings in eclipse.ini file as follows,
-Xms3g
-Xmx3g
-XX:MaxPermSize=3g
Let me know whether this works for you!

Windows Java thread affinity with OpenHFT AffinityLock

I'm trying to optimize an application by binding its threads to different cores. To begin with, I would like to bind the entire application to a single core using the Affinity-3.0.6 package from OpenHFT.
So far I've had no luck. At first I imported the package and tried the command
AffinityLock al = AffinityLock.acquireCore();
was warned about not having JNA access, so I downloaded the jna-4.2.2 package and imported it as well.
After the second import, the same command gives the following error:
WARN Affinity - Windows JNA-based affinity not usable because it
failed to load! Reason: java.lang.NoClassDefFoundError:
com/sun/jna/platform/win32/WinDef$DWORD
and the execution is not bound to the single core.
I'm blindly trying to give the software what it wants without understanding what it needs.
i suspect youve added jna.jar, but not jna-platform.jar to your project, and the class that fails to load ispart of platform.
see docs and download links here.

Categories