This is a migrated thread and some comments may be shown as answers.

"java.exe" exited with code 2

17 Answers 270 Views
Calendar & Scheduling
This is a migrated thread and some comments may be shown as answers.
Roman
Top achievements
Rank 1
Roman asked on 24 Oct 2016, 02:45 PM

Hi all,

I have an issue with setting up Telerik.UI.for.Xamarin. 
I have made all as required in http://docs.telerik.com/devtools/xamarin/controls/calendar/getting-started/calendar-getting-started .

The issue is that I have and exception when starting to debug on emulator:

C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2056,3): error MSB6006: "java.exe" exited with code 2.

I have changed Java Max Heap Size to 1G and it doesn't help me.

Microsoft Visual Studio Community 2015 Version 14.0.25422.01 Update 3
Microsoft .Net Framework Version 4.6.01586

<package id="Telerik.UI.for.Xamarin.Trial" version="2016.3.1012.3" targetFramework="portable45-net45+win8+wpa81" />
<package id="Xamarin.Forms" version="2.3.2.127" targetFramework="portable45-net45+win8+wpa81" />
<package id="Xamarin.Forms.Maps" version="2.3.2.127" targetFramework="portable45-net45+win8+wpa81" />

 android:versionName="1.0.0" android:versionCode="7"
Google Play Service Version = 33

Windows 10 Pro 64-bit OS

Maybe I forget something? 

I haven't this issue until I have downloaded Telerik and set 
[assembly: ExportRenderer( typeof( Telerik.XamarinForms.Input.RadCalendar ), typeof( Telerik.XamarinForms.InputRenderer.Android.CalendarRenderer ) )]
in MainActivity and set 
Xamarin.Forms.Forms.Init( this, bundle );
Telerik.XamarinForms.Common.Android.TelerikForms.Init();

Also, MainActivity does inherit FormsAppCompatActivity
public class MainActivity : FormsAppCompatActivity.

Best regard,
Roman Hapatyn

17 Answers, 1 is accepted

Sort by
0
Lance | Manager Technical Support
Telerik team
answered on 24 Oct 2016, 07:12 PM
Hello Roman,

That error can happen for a variety of reasons. One of the more popular reasons is that you've surpassed the Davlik 65K limit (due to too many external library references). 

The fix for this is usually to enable MultiDex or decrease your external dependencies.

This problem is ultimately is not related to the Telerik UI for Xamarin components but to make sure, I've attached a File > New > TelerikXFApp sample app (all platforms). This is a blank app with just a landing page that is UI for Xamarin enabled. Run the app on your side and confirm you see StartPage.xaml load.

Here is what you need to do to get the attached app running:
1 - Download, extract and open the solution in Visual Studio (if you need to remove any projects you do not have an SDK installed for, like UWP, you can do that now)
2 - Right click on the solution and select Manage Nuget Packages for Solution.
3 - Click the "Restore Packages" button that will appear at the top right in a yellow bar
4 - Once all the packages are restored, right click on the RomanTestApp.Portable project and select Build
5 - Right click on the android project and select "Set as Startup Project" and then select Build
6 - Deploy the app (I have successfully deployed this to an emulator and to the Samsung Galaxy 7 Edge running android 6.0.1.)

A couple tips to make sure that your current project(s) are using UI for Xamarin's requirements:

System Requirements
- You have the required dependencies for the components
- You have the required Android Support Libraries (important, UI for Xamarin releases are tied to specific versions of Android SDKs and support libraries).

Regards,
Lance | Tech Support Engineer, Sr.
Telerik by Progress
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Leonard
Top achievements
Rank 1
answered on 22 May 2017, 09:31 PM
Hi I am having an issue with a the same message, "java.exe" exited with code 2, however I am not having an issue when I am using some single packages such as dataVisualization.trial and skiasharp.trial for the gauge component but when I try to install all the telerik packages I get the same exception, since I have a current working project I wont use another sample project but would like to get my existing project working with telerik also I have enabled multidex and i get the same error happening so i am afraid to have run out of options on this one...??
0
Lance | Manager Technical Support
Telerik team
answered on 22 May 2017, 10:38 PM
Hi Roman,

Do you have the Max Heap size set to 1G? See here for specifics.

Another reason this could be happening is that you're using an Android SDK that we do not yet support. The highest version of the SDK you can compile with is Android 6 (SDK 23), see here for more info on that.

We are planning on adding Android 7 (SDKs 24 and 25) in an upcoming release shortly.

Regards,
Lance | Tech Support Engineer, Sr.
Telerik by Progress
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Leonard
Top achievements
Rank 1
answered on 22 May 2017, 11:42 PM

Hi lance, set Max Heap size to 1G and changed targets but unfortunately same issue.

Using the following:

Compile using android version 6.0 - Check

Multidex enabled - Check

Max Heap size set to 1G - Check

Targeting android version android version 6.0 - Check

Can I ask which version of Xamarin forms should i be using for support with Telerik?

0
Lance | Manager Technical Support
Telerik team
answered on 23 May 2017, 12:02 AM
Hi Roman,

So you can see this first-hand, I've attached a Calendar demo I build just a couple hours ago, also here's a screenshot of my Android SDK Manager.

Note, the demo is using 2017.2.522, your listed version is several releases ago. Are you still using 2016.3.1012? You can get the update from here, it contains a lot of  fixes since 2016's releases.

Regards,
Lance | Tech Support Engineer, Sr.
Telerik by Progress
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Leonard
Top achievements
Rank 1
answered on 23 May 2017, 12:24 AM
Hi lance, I am not Roman, and I am a new member in this thread, I am using 2017.2.522 as well
0
Ivaylo Gergov
Telerik team
answered on 23 May 2017, 10:36 AM
Hi Leonard,

I have answered you in the following forum post. I hope this solves your issue.

Regards,
Ivaylo Gergov
Telerik by Progress
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Dan
Top achievements
Rank 1
answered on 29 Nov 2017, 12:29 AM

Hey Lance,

I have the same issue, so I created a brand new blank xamarin forms project, added the Telerik.UI.for.Xamarin from NuGet, set my Android target and compiler to version 6 and set the Heap to 1G.

Still getting the "java.exe" exited with code 2. error on this brand new blank project.

Any ideas?


0
Lance | Manager Technical Support
Telerik team
answered on 29 Nov 2017, 08:13 PM
Hello Dan,

There is a wide range of reasons for this error, it could be that you've hit the Davlik limit. Enable MultiDex and try again.

I've attached a UI for Xamarin blank application for you to try and build on your side. If you're seeing the error building my demo, then you have an issue with your Java SDK (JDK 1.8) or Android SDK (SDKs/Build Tools/ Platform tools).

Here's a screenshot of my demo project's settings:



Regards,
Lance | Tech Support Engineer, Sr.
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Lance | Manager Technical Support
Telerik team
answered on 29 Nov 2017, 08:30 PM
Hi Dan,

Sorry for the double reply, the last demo I sent you was built targeting Android 7. I've built you another Xamarin.Forms solution, with just the Android project which targets Android 6 (23.3.0), find it attached.

Take following steps:

1 - Rebuild the Portable project first
2 - Rebuild the android project next

I can confirm that it works for me, and

So that you can compare your installed components, here's a couple screenshots from my Android SDK Manager:

Platform tools, Build tools and SDK Platform



EXTRAS



Regards,
Lance | Tech Support Engineer, Sr.
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Dan
Top achievements
Rank 1
answered on 30 Nov 2017, 12:18 AM

Thanks Lance, I did get it working with heap size and multi-dex, and I can target Oreo and not get any errors with the latest Telerik dll's.

Thanks for all your great posts and responses!

 

0
Alain
Top achievements
Rank 1
answered on 30 Nov 2017, 07:53 PM

This solved the issue for me!! Thanks

 

I was stuck for 2 days.

0
Christian
Top achievements
Rank 1
answered on 20 May 2019, 07:11 PM

Hi all,

I am having the same issue , VS2019 I just created a brand new application and get the error:

 

SeverityCodeDescriptionProjectFileLineSuppression State
Error"java.exe" exited with code 2.TelerikXamarinApp1.Android

 

 

0
Lance | Manager Technical Support
Telerik team
answered on 20 May 2019, 07:18 PM
Hello Christian,

You now need to enable Multi-dex out of the box. This is because we moved up our minimum version of Xamarin.Forms to 3.6, which has dependencies.

Enable Multi-dex

Take the following steps:

1. Open the Android project's properties window
2. Switch to the Android Options tab
3. Check the "Enable Multi-dex" checkbox


4. Save and rebuild the Android project

Increase Max Heap Size

I would also increase the Max Java heap to 1G

1. Go back to the same properties > Android Options page
2. click the "Advanced" button
3. Enter "1G" into the heap setting.



5. Save and rebuild the Android project.

Regards,
Lance | Technical Support Engineer, Principal
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Christian
Top achievements
Rank 1
answered on 20 May 2019, 09:15 PM

Yes that worked.

 

Thanks.

0
Martin
Top achievements
Rank 1
answered on 27 Apr 2020, 07:16 PM

Hi,

I am having the same issue and I have already set the Heap to 1G, enabled Multidex and targeted android version 6.0..

Do you have any ideas how I can fix this issue?

0
Lance | Manager Technical Support
Telerik team
answered on 27 Apr 2020, 08:28 PM

Hi Martin,

This could be from a wide range of causes (see all the search results here). That error message just means that the java side of things failed at something.

Double check that your SDKs are all at the required min/max versions of all your other dependencies (especially if you just updated something). For Telerik UI for Xamarin, you need API 28.0.0.1 support libraries, see the Required Android Support Libraries documentation.

I don't see a Telerik UI for Xamarin license on your account and this is the first post you've ever had on this account. Are you not using UI for Xamarin and are replying here for general Xamarin support?

  • If yes, I recommend reposting on StackOverlflow, in the Xamarin forums or live chat on the Xamarin Slack (use this xamarinchat inviter).
  • If not, and you do have a Telerik UI for Xamarin license, please open a Support Ticket here and attach your projects in a ZIP so the team can take a closer look (please delete the bin and obj folders from every project before zipping it up). 

Good luck!

Regards,
Lance | Team Lead - US DevTools Support
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
Tags
Calendar & Scheduling
Asked by
Roman
Top achievements
Rank 1
Answers by
Lance | Manager Technical Support
Telerik team
Leonard
Top achievements
Rank 1
Ivaylo Gergov
Telerik team
Dan
Top achievements
Rank 1
Alain
Top achievements
Rank 1
Christian
Top achievements
Rank 1
Martin
Top achievements
Rank 1
Share this question
or