0

Need your help on this. I am stuck in double bind in resolving the below error.

When I check the "Android dependencies" & "Private Libraries" from Java Build Path/Order & Export. I get error - "Java dex Heap Space Error" -- I tried increasing the XMAX size upto 8536m in eclipse.ini file - but still the Java dex Heap Space Error remained.

And When I un-check the "Android Dependencies" & "Private Libraries" from Java build Path. I get "Java.lang.Class Not Found Exception - of com.example.googlemaps.MainActivity

I am using JDK 1.7

Attaching here everything:

Project Structure

enter image description here

enter image description here

Android Manifest:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.googlemaps"
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="18" />
<permission android:name="com.example.googlemaps.permission.MAPS_RECEIVE"           android:protectionLevel="signature"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />

<!-- Required to show current location -->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

<!-- Required OpenGL ES 2.0. for Maps V2 -->
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />


<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
    android:name="com.example.googlemaps.MainActivity"
    android:label="@string/app_name" >
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />

        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
  </activity>
</application> 

<!-- Goolge API Key -->
 <meta-data
    android:name="com.google.android.maps.v2.API_KEY"
    android:value="AIzaSyCOhACbfq4DORsY56MQF38FiKqXC0-A1wc" />

<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
</manifest>

MainActivity.Java

package com.example.googlemaps;

import com.google.android.gms.maps.GoogleMap;

import android.app.Activity;
import android.os.Bundle;
import android.widget.Toast;

import android.app.Activity;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;

public class MainActivity extends FragmentActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
 }
}

Activity_main.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >

 <fragment
    android:name="com.google.android.gms.maps.SupportMapFragment"

    android:id="@+id/map"
    android:layout_width="match_parent"
    android:layout_height="match_parent" />
</LinearLayout>

Eclipse.ini

-startup
plugins/org.eclipse.equinox.launcher_1.3.0.v20120522-1813.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.200.v20120913-144807
-product
com.android.ide.eclipse.adt.package.product
--launcher.XXMaxPermSize
8512M
-showsplash
com.android.ide.eclipse.adt.package.product
--launcher.XXMaxPermSize
8512m
--launcher.defaultAction
openFile
-vm
C:/Program Files (x86)/Java/jdk1.7.0_25/bin/javaw.exe
-Dosgi.requiredJavaVersion=1.6
-Xms8536m
-Xmx8536m
-Declipse.buildId=v22.0.5-757759

Inside dx.bat in location: C:\Users\nikshrivastava\Downloads\adt-bundle-windows-x86-20130729\sdk\build-tools\android-4.3

:JarFileOk

set jarpath=%frameworkdir%%jarfile%

set javaOpts=
set args=

REM By default, give dx a max heap size of 1 gig and a stack size of 1meg.
rem This can be overridden by using "-JXmx..." and "-JXss..." options below.
set defaultXmx=-Xmx1624M
set defaultXss=-Xss1m
Nikhil
  • 21
  • 3

2 Answers2

0

First check your Java Version. if it's not 1.6 Update it to 1.6 or 1.7 Second :This can be solved by increasing the heap memory size for dx.jar, located in your Android SDK.

This is can be done by

editing the dx.bat file adt-bundle-windows-x86_64-20130729\adt-bundle-windows-x86_64-20130729\sdk\build-tools\android-4.3\dex.bat and update its set defaultXmx=-Xmx1024M value to set defaultXmx=-Xmx1624M

if this not worked Check this soulotions :

Conversion to Dalvik format failed: Unable to execute dex: Java heap space

Community
  • 1
  • 1
Pouya Samie
  • 3,718
  • 1
  • 21
  • 34
  • thanks for your i/p, but still not working. Have updated changes u asked in question. – Nikhil Jan 06 '14 at 15:03
  • Change your MinSdk to 9 – Pouya Samie Jan 06 '14 at 15:16
  • nothing changed, i installed Android Studio, will try my luck there for Google maps!! – Nikhil Jan 07 '14 at 10:34
  • Did you ever find a solution to this? I'm stuck as well with no fix in site. How is anyone else getting this to work? It's pretty sad that my next move is to dump eclipse and try android studio...and who know how many issues I'll have with that! – KFP Jan 14 '14 at 14:23
  • Hey surprisingly it worked, I tried using the old version of - "google play Services lib" - Version 8. And it worked. -- So Don't use the latest version of "google play services lib". Try older one's, there could be some configuration issues with latest one', i am not sure. – Nikhil Mar 13 '14 at 11:37
0

I tried using the Older Version of "Google Play Services lib" Version 8 - and it worked successfully.

Nikhil
  • 21
  • 3