Android Question Can't increase MaxRamForDex

MrKim

Well-Known Member
Licensed User
Longtime User
I am trying to increase MaxRamForDex from 512 to 1028 but compile throws the following error:

B4X:
B4A Version: 7.30
Parsing code.    (0.03s)
Compiling code.    (0.17s)
Compiling layouts code.    (0.02s)
Organizing libraries.    (0.00s)
Generating R file.    (0.09s)
Compiling generated Java code.    Error

Error occurred during initialization of VM
Could not reserve enough space for 1052672KB object heap

HP Laptop Win 7 PRO with 8 gigs of RAM.
Task Manager shows the following:

upload_2018-2-20_15-48-20.png


any help appreciated.
 

Attachments

  • upload_2018-2-20_15-46-25.png
    upload_2018-2-20_15-46-25.png
    92.4 KB · Views: 294

MrKim

Well-Known Member
Licensed User
Longtime User
this is 32bit java
Note that you should use platforms/android-27/android.jar

Sigh,

This is where I really get lost. All I want to do is add ads to one of my aps which led me to Admob but that doesn't work the way it used to so you need to use FireBase which needs more MaxRamForDex (or was it that you also need Google Play Services and THAT requires more MaxRamForDex? Can't remember) and somewhere in there it says run SdKmanager.bat which I found in F:\Android\Android\android-sdk\tools\bin but when I click on it it just flashes a DOS Window and doesn't open anything. I found B4ASdkManager.jar set the path to sdkmanager.bat but B4A Sdk Manager has nothing in it Other than the Words 'Installed' and 'All'. I ran sdkmanager.bat from the command line it says

B4X:
ERROR: JAVA_HOME is set to an invalid directory: C:\Program Files (x86)\Java\jdk
1.7.0_07\bin

Please set the JAVA_HOME variable in your environment to match the
location of your Java installation.

but that IS a valid directory although I also have
B4X:
C:\Program Files (x86)\Java\jdk1.8.0_131\bin
C:\Program Files (x86)\Java\jre1.8.0_45\bin
C:\Program Files (x86)\Java\jre1.8.0_161\bin
not to mention when I look at my environment variables in System Properties JAVA_HOME is not mentioned.

I have an Android.jar in folders F:\Android\Android\android-sdk\platforms\android-10 through android-23. Where do I get 27? I have followed the instruction HERE: https://www.b4x.com/b4a.html to no avail.

I would pay someone to remote in to my computer and fix all of the configuration stuff for me. It has me baffled. I just want to write code. :p
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
I have an Android.jar in folders F:\Android\Android\android-sdk\platforms\android-10 through android-23. Where do I get 27? I have followed the instruction HERE: https://www.b4x.com/b4a.html to no avail.

I would pay someone to remote in to my computer and fix all of the configuration stuff for me.
Contact me if you want.

I live in Germany (GMT+1) so now it is 7:20 AM
 
Upvote 0

MrKim

Well-Known Member
Licensed User
Longtime User
Can you post a screenshot of B4A Sdk Manager?
upload_2018-2-27_9-42-9.png


Here is sdkmanager.bat

B4X:
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem  sdkmanager startup script for Windows
@rem
@rem ##########################################################################

@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal

set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%..

@rem Add default JVM options here. You can also use JAVA_OPTS and SDKMANAGER_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Dcom.android.sdklib.toolsdir=%~dp0\.."

@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome

set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.

goto fail

:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto init

echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.

goto fail

:init
@rem Get command-line arguments, handling Windows variants

if not "%OS%" == "Windows_NT" goto win9xME_args
if "%@eval[2+2]" == "4" goto 4NT_args

:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2

:win9xME_args_slurp
if "x%~1" == "x" goto execute

set CMD_LINE_ARGS=%*
goto execute

:4NT_args
@rem Get arguments from the 4NT Shell from JP Software
set CMD_LINE_ARGS=%$

:execute
@rem Setup the command line

set CLASSPATH=%APP_HOME%\lib\sdklib-25.3.0-dev.jar;%APP_HOME%\lib\layoutlib-api-25.3.0-dev.jar;%APP_HOME%\lib\dvlib-25.3.0-dev.jar;%APP_HOME%\lib\repository-25.3.0-dev.jar;%APP_HOME%\lib\gson-2.2.4.jar;%APP_HOME%\lib\commons-compress-1.8.1.jar;%APP_HOME%\lib\httpclient-4.1.1.jar;%APP_HOME%\lib\httpmime-4.1.jar;%APP_HOME%\lib\common-25.3.0-dev.jar;%APP_HOME%\lib\kxml2-2.3.0.jar;%APP_HOME%\lib\annotations-25.3.0-dev.jar;%APP_HOME%\lib\annotations-12.0.jar;%APP_HOME%\lib\jimfs-1.1.jar;%APP_HOME%\lib\httpcore-4.1.jar;%APP_HOME%\lib\commons-logging-1.1.1.jar;%APP_HOME%\lib\commons-codec-1.4.jar;%APP_HOME%\lib\guava-18.0.jar

@rem Execute sdkmanager
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %SDKMANAGER_OPTS%  -classpath "%CLASSPATH%" com.android.sdklib.tool.SdkManagerCli %CMD_LINE_ARGS%

:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd

:fail
rem Set variable SDKMANAGER_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if  not "" == "%SDKMANAGER_EXIT_CONSOLE%" exit 1
exit /b 1

:mainEnd
if "%OS%"=="Windows_NT" endlocal

:omega
 
Upvote 0

MrKim

Well-Known Member
Licensed User
Longtime User
So, I was able (I think) to fix the first batch file error. Evidently JAVA_HOME is supposed to be pointed NOT to \bin, but one directory up from that.
After fixing that there was no change in the B4A sdk manager output so I ran the sdkmanager.bat from the command line again and I get the following error:
B4X:
F:\Android\Android\android-sdk\tools\bin>sdkmanager.bat
Exception in thread "main" java.lang.UnsupportedClassVersionError: com/android/s
dklib/tool/SdkManagerCli : Unsupported major.minor version 52.0
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:791)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:14
2)
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
        at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
        at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:480)

I appreciate you guys taking the time to help with this. Keeping track of what belongs with what just fries my brain.
 
Upvote 0
Top