Bug 33044 - "error: class, interface, or enum expected" when packaging Android application
Summary: "error: class, interface, or enum expected" when packaging Android application
Status: RESOLVED NOT_REPRODUCIBLE
Alias: None
Product: Visual Studio Extensions
Classification: Xamarin
Component: Android ()
Version: 3.11 (C5)
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2015-08-12 23:58 UTC by Brendan Zagaeski (Xamarin Team, assistant)
Modified: 2016-12-22 22:57 UTC (History)
4 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED NOT_REPRODUCIBLE

Description Brendan Zagaeski (Xamarin Team, assistant) 2015-08-12 23:58:52 UTC
I am copying the available information so far into a bug report for tracking.

From: http://forums.xamarin.com/discussion/comment/146123/#Comment_146123

> I cannot package any application, build is successful but when I try to
> create the package I get an error complaining of syntax errors in
> \obj\Debug\android\src\hubb\native\app\android\R.java.
> 
> Processing: obj\Debug\res\layout\main.xml
>
> Processing: obj\Debug\res\values\strings.xml
> C:\Program Files (x86)\Java\jdk1.7.0_55\bin\javac.exe -J-Dfile.encoding=UTF8
> -d obj\Debug\android\bin\classes -classpath "C:\Program Files (x86)\Reference
> Assemblies\Microsoft\Framework\MonoAndroid\v5.0\mono.android.jar"
> -bootclasspath "C:\Program Files
> (x86)\Android\android-sdk\platforms\android-21\android.jar" -encoding UTF-8
>
> "@C:\Users\nigel\AppData\Local\Temp\tmp2A95.tmp" 
> error: expected
> package hubb.native.app.android;
> 
> error: class, interface, or enum expected
> package hubb.native.app.android;
> 
> error: class, interface, or enum expected
> package hubb.native.app.android;
> 
> Build FAILED.




## Version information

Visual Studio 2015 Enterprise
XamarinVS 3.11.816
Comment 1 Brendan Zagaeski (Xamarin Team, assistant) 2015-08-13 00:07:34 UTC
## Preliminary notes and questions


1. At first glance this seems unlikely to be caused by Visual Studio 2015. If you have another version of Visual Studio installed on the same machine, does it demonstrate the same problem?



2. Do you receive similar errors if you create a new Android application using one of the template projects? If not, and you would be able to zip up and attach back a test case that demonstrates the problem (optionally marked private), that would be perfect.



3. For good measure, you can paste your complete version information into a txt file and attach that back too.

"Help -> About Microsoft Visual Studio -> Copy Info [button]"



4. You can also collect your Android SDK tools version: open the Android SDK Manager ("Tools -> Open Android SDK Manager"), take a screenshot of the top "Tools" section, and attach it back. Or if you prefer, you can instead type out these versions in text.



5. You can collect your diagnostic MSBuild output after attempting to build and deploy the app:

http://developer.xamarin.com/guides/android/troubleshooting/troubleshooting/#Diagnostic_MSBuild_Output

(Copy and paste the information from the output window into a file, and attach that file back.)



Thanks in advance!
Comment 2 Nigel Sampson 2015-08-13 16:26:52 UTC
1. I don't have another copy of Visual Studio on this machine, but can confirm packing is working on a separate machine with the same version of Windows 10, Visual Studio 2015 and Xamarin.

2. I receive the same error from File -> New Project -> Blank Android App.

3. Microsoft Visual Studio Enterprise 2015
Version 14.0.23107.0 D14REL
Microsoft .NET Framework
Version 4.6.00079

Installed Version: Enterprise

Architecture and Modeling Tools   00322-80000-00000-AA605
Microsoft Architecture and Modeling Tools
    
UML® and Unified Modeling Language™ are trademarks or registered trademarks of the Object Management Group, Inc. in the United States and other countries.

Visual Basic 2015   00322-80000-00000-AA605
Microsoft Visual Basic 2015

Visual C# 2015   00322-80000-00000-AA605
Microsoft Visual C# 2015

Visual C++ 2015   00322-80000-00000-AA605
Microsoft Visual C++ 2015

Visual F# 2015 RC   00322-80000-00000-AA605
Microsoft Visual F# 2015 RC

Windows Phone SDK 8.0 - ENU   00322-80000-00000-AA605
Windows Phone SDK 8.0 - ENU

Application Insights Tools for Visual Studio Package   1.0
Application Insights Tools for Visual Studio

ASP.NET and Web Tools   14.0.20626.0
ASP.NET and Web Tools

ASP.NET Web Frameworks and Tools 2013   5.2.30624.0
For additional information, visit http://www.asp.net/

Common Azure Tools   1.5
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

GenerateUnitTest   1.0
Generates unit test code for methods in classes under test.

GitHub.VisualStudio   1.0
A Visual Studio Extension that brings the GitHub Flow into Visual Studio.

JetBrains ReSharper Ultimate 2015.1.3   Build 102.0.20150724.141603
JetBrains ReSharper Ultimate package for Microsoft Visual Studio. For more information about ReSharper Ultimate, visit http://www.jetbrains.com/resharper. Copyright © 2015 JetBrains, Inc.

Microsoft Azure Mobile Services Tools   1.4
Microsoft Azure Mobile Services Tools

Microsoft Code Digger   0.9
Microsoft Code Digger

Microsoft.Pex.VisualStudio   1.0
Pex

NuGet Package Manager   3.0.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.

PreEmptive Analytics Visualizer   1.2
Microsoft Visual Studio extension to visualize aggregated summaries from the PreEmptive Analytics product.

SQL Server Data Tools   14.0.50730.0
Microsoft SQL Server Data Tools

Visual Studio Tools for Universal Windows Apps   14.0.23121.00 D14OOB
The Visual Studio Tools for Universal Windows apps allow you to build a single universal app experience that can reach every device running Windows 10: phone, tablet, PC, and more. It includes the Microsoft Windows 10 Software Development Kit.

Xamarin   3.11.816.0 (cefca47)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin.Android   5.1.5.2 (2e8568c9f3a3ce0b66203412a268b39618824338)
Visual Studio plugin to enable development for Xamarin.Android.

Xamarin.iOS   8.10.4.0 (099f94bba4532201864249a9064bf73be56f8667)
Visual Studio extension to enable development for Xamarin.iOS.

Xamarin.iOS Unified Migration   1.0
Automated migration for Xamarin iOS Classic projects to Unified

Xamarin.TestCloud.Integration   1.0
Early preview of Xamarin Test Cloud integration

4. Opening the SDK Manager through the menu gives the error "Command did not execute successfully due to an unexpected exception", the Output window contains no extra information.

Launching from the start menu gives the error "Failed to execute tools\android.bat".
Comment 3 Nigel Sampson 2015-08-13 16:45:10 UTC
Since the above comment I extracted the zip from the \android-sdk\temp folder and copied the tools folder over (for some reason a lot of files were missing).

This did not solve the packing issue, but I was able to open the SDK manager.

For tools

Installed: 19.1, 21.1.2, 22.0.1, 22 and 24.3.3.
Comment 4 Brendan Zagaeski (Xamarin Team, assistant) 2015-08-15 13:42:01 UTC
Thanks for the additional information. It sounds like there is some installation / setup issue that is particular to your specific machine.

To give the Xamarin team the best information to attempt to diagnose what part of the setup is in an unexpected state, I'll request the last 2 items of information from comment 1.

Since this issue seems to be specific to one computer, if you have a Business license or higher, then this would be a good time to start an email Support case [1] to help troubleshoot the issue. Feel free to send an email to the Support team and include a link to this bug report.

[1] https://kb.xamarin.com/customer/portal/articles/1632104-how-do-i-contact-xamarin-for-support-



> 4. You can also collect your Android SDK tools version: open the Android SDK
> Manager ("Tools -> Open Android SDK Manager"), take a screenshot of the top
> "Tools" section, and attach it back. Or if you prefer, you can instead type out
> these versions in text.
> 
> 
> 
> 5. You can collect your diagnostic MSBuild output after attempting to build and
> deploy the app:
> 
> http://developer.xamarin.com/guides/android/troubleshooting/troubleshooting/#Diagnostic_MSBuild_Output
> 
> (Copy and paste the information from the output window into a file, and attach
> that file back.)




(For item 4, I see that you've included some information in comment 3:

> For tools
>
> Installed: 19.1, 21.1.2, 22.0.1, 22 and 24.3.3.


But I'm not quite sure which versions are which. Which are "Android SDK Tools", which are "Android SDK Platform-tools", and which are "Android SDK Build-tools"?)



Thanks in advance!
Comment 5 Jose Gallardo 2016-12-22 22:57:53 UTC
Hi,

I'm resolving the bug tentatively as NotReproducible at our side.
That said, if you're still facing this issue with current bits, please feel free to reopen the bug and we'll keep investigating.
Thanks