7

I recently moved from eclipse to Intellij and I have problem with using Android tools. When I click Tools->Android->Monitor(DDMS included) I get error saying:

Failed to load the JNI shared library "C:\Program Files\Java\jdk1.7.0_17\bin..\jre\bin\server\jvm.dll".

I am using lastest community edition of Intellij. I would be thankful for any help.

Srokowski Maciej
  • 431
  • 5
  • 15
  • Can you confirm that path is valid? Is everything setup on your IDE, SDK, etc? – Mike Schwartz Mar 29 '13 at 16:40
  • Yep, everything is working I can deploy apps ,run them on device ,emulator or debug – Srokowski Maciej Mar 29 '13 at 17:34
  • Does it work if you start it from `%ANDROID_SDK%\tools\monitor.bat`? – CrazyCoder Mar 29 '13 at 17:40
  • Yes, it works when I start it this way – Srokowski Maciej Mar 29 '13 at 17:46
  • Here: http://stackoverflow.com/questions/7352493/failed-to-load-the-jni-shared-library-jdk they say that cause is diffrent architecture of IDE and SDK ,may it be the cause for IntelliJ too? – Srokowski Maciej Mar 29 '13 at 17:53
  • Actually IDEA starts this file: `%ANDROID_SDK%\tools\lib\monitor-x86_64\monitor.exe` if you are using 64-bit OS. Does it work for you outside of IDEA? – CrazyCoder Mar 29 '13 at 18:28
  • You can replace `IDEA\bin\log.xml` with [this version](https://dl.dropbox.com/u/2752840/ShareXmod/2013-03/log.xml), then restart IDEA, start monitor, when it fails look inside [idea.log](http://intellij-support.jetbrains.com/entries/23352446) for the command line being executed, then try to run it outside of IDEA. – CrazyCoder Mar 29 '13 at 18:34
  • Here is log file from last lunching of IDE and trying to run Monitor, I can't track anything from this log http://speedy.sh/sY9ES/idea.log – Srokowski Maciej Mar 29 '13 at 19:42
  • This log doesn't contain relevant info, I'll check later why. Did you try running monitor.exe, does it work? – CrazyCoder Mar 29 '13 at 22:05
  • You mean android.bat from Android_SDK->tools? Yes, it works correctly – Srokowski Maciej Mar 30 '13 at 09:36
  • No, I mean `%ANDROID_SDK%\tools\lib\monitor-x86_64\monitor.exe`, see my comments above. – CrazyCoder Mar 31 '13 at 00:56

5 Answers5

6

It is simple! Just use [IntelliJ Idea Directory]\bin\idea64.exe

Artur Movsesyan
  • 744
  • 6
  • 21
3

I had the same problem. My environment and my solution:

  • I have a 64bit Java. You can know your version with this code snippet:

    public class Test {
       public static void main(String args[]) {
           System.out.println(System.getProperty("sun.arch.data.model") );
       }  
    }
    
  • I was running the 32bit version of Intellij ("C:\Program Files (x86)\JetBrains\IntelliJ IDEA Community Edition 12.1.3\bin\idea.exe")

  • I just change to idea64.exe ("C:\Program Files (x86)\JetBrains\IntelliJ IDEA Community Edition 12.1.3\bin\idea64.exe"). Make a direct access to your desktop.

  • It worked ... like a boss.

Hope it helps.

Marcos
  • 4,643
  • 7
  • 33
  • 60
1

You need a 64-bit Package:

64-bit Windows OS
64-bit Java (JDK it must be 1.7 ) 

Please try with this

itsrajesh4uguys
  • 4,610
  • 3
  • 20
  • 31
0

I had the same problem. In my environment, the cause was that Intellij Community started as a 32bit executable, while the Android Monitor tool is a 64bit exe. So, a clean solution is to start Intellij with a 64bit JVM:

  1. define the environment variable IDEA_JDK pointing to the path of the 64bit JDK (for example C:\Program Files\Java\jdk1.6.0_43)
  2. modify the shortcut used to run Intellij in order to launch idea.bat (instead of idea.exe)

When idea.bat finds the environment variable %IDEA_JDK%, it runs Intellij using the 64bit JVM.

This solved the problem (in my environment).

Syscall
  • 19,327
  • 10
  • 37
  • 52
Gio
  • 94
  • 5
0

I had to change my JAVA_HOME environment variable to point at the 64-bit Java.

bulltorious
  • 7,769
  • 4
  • 49
  • 78