question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Build error: MainActivity.java:20: error: <identifier> expected package game.for.lina;

See original GitHub issue

I created a new tabrisjs project and got it validated on tabrisjs.com, but when I try to build it, I get the following error. Why do I get the error during build?

I paste the config.xml, package,json and the build log file below

###### config.xml
<?xml version='1.0' encoding='utf-8'?>
<widget
    id="game.for.lina"
    version="1.0.0"
    xmlns:gap="http://phonegap.com/ns/1.0"
    xmlns="http://www.w3.org/ns/widgets"
    xmlns:cdv="http://cordova.apache.org/ns/1.0">

    <name>Spiel Für Lina</name>
    <description>
        Spiel für Lina
    </description>
    <author email="me@me.com" href="http://www.me.me">
        Me
    </author>

    <access origin="*" />

    <preference name="EnableDeveloperConsole" value="false"/>
</widget>
#####package.json
{
  "name": "game-for-lina",
  "description": "Spiel für Lina",
  "main": "app.js",
  "dependencies": {
    "tabris": "1.0.0"
  }
}
######build error from log file
AAPT warning(Job{title=Cruncher btn_check_label_background.9.png, latch=BooleanLatch{signaled=false}, result=false}): /home/travis/build/eclipsesource/tabris-js-build-template/build/platforms/android/build/intermediates/exploded-aar/com.eclipsesource.tabris/tabris-android/2.0.0/res/drawable-mdpi-v17/btn_check_label_background.9.png: libpng warning: iCCP: Not recognizing known sRGB profile that has been edited
AAPT warning(Job{title=Cruncher ic_drawer.png, latch=BooleanLatch{signaled=false}, result=false}): /home/travis/build/eclipsesource/tabris-js-build-template/build/platforms/android/build/intermediates/exploded-aar/com.eclipsesource.tabris/tabris-android/2.0.0/res/drawable-mdpi-v4/ic_drawer.png: libpng warning: iCCP: Not recognizing known sRGB profile that has been edited
:processDebugManifest
:processDebugResources
:generateDebugSources
:compileDebugJava/home/travis/build/eclipsesource/tabris-js-build-template/build/platforms/android/src/game/for/lina/MainActivity.java:20: error: <identifier> expected
package game.for.lina;
             ^
/home/travis/build/eclipsesource/tabris-js-build-template/build/platforms/android/src/game/for/lina/MainActivity.java:20: error: class, interface, or enum expected
package game.for.lina;
                ^
/home/travis/build/eclipsesource/tabris-js-build-template/build/platforms/android/src/game/for/lina/MainActivity.java:20: error: class, interface, or enum expected
package game.for.lina;
                 ^
/home/travis/build/eclipsesource/tabris-js-build-template/build/platforms/android/build/generated/source/r/debug/game/for/lina/R.java:8: error: <identifier> expected
package game.for.lina;
             ^
/home/travis/build/eclipsesource/tabris-js-build-template/build/platforms/android/build/generated/source/r/debug/game/for/lina/R.java:8: error: class, interface, or enum expected
package game.for.lina;
                ^
/home/travis/build/eclipsesource/tabris-js-build-template/build/platforms/android/build/generated/source/r/debug/game/for/lina/R.java:8: error: class, interface, or enum expected
package game.for.lina;
                 ^
/home/travis/build/eclipsesource/tabris-js-build-template/build/platforms/android/build/generated/source/buildConfig/debug/game/for/lina/BuildConfig.java:4: error: <identifier> expected
package game.for.lina;
             ^
/home/travis/build/eclipsesource/tabris-js-build-template/build/platforms/android/build/generated/source/buildConfig/debug/game/for/lina/BuildConfig.java:4: error: class, interface, or enum expected
package game.for.lina;
                ^
/home/travis/build/eclipsesource/tabris-js-build-template/build/platforms/android/build/generated/source/buildConfig/debug/game/for/lina/BuildConfig.java:4: error: class, interface, or enum expected
package game.for.lina;
                 ^
9 errors

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileDebugJava'.
> Compilation failed; see the compiler error output for details.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
 FAILED

BUILD FAILED

Total time: 51.823 secs

/home/travis/build/eclipsesource/tabris-js-build-template/build/platforms/android/cordova/node_modules/q/q.js:126
                    throw e;
                          ^
Error code 1 for command: /home/travis/build/eclipsesource/tabris-js-build-template/build/platforms/android/gradlew with args: cdvBuildDebug,-b,/home/travis/build/eclipsesource/tabris-js-build-template/build/platforms/android/build.gradle,-Dorg.gradle.daemon=true
ERROR building one of the platforms: Error: /home/travis/build/eclipsesource/tabris-js-build-template/build/platforms/android/cordova/build: Command failed with exit code 8
You may not have the required environment or OS to build this project
Error: /home/travis/build/eclipsesource/tabris-js-build-template/build/platforms/android/cordova/build: Command failed with exit code 8
    at ChildProcess.whenDone (/home/travis/.nvm/v0.10.36/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:131:23)
    at ChildProcess.emit (events.js:98:17)
    at maybeClose (child_process.js:766:16)
    at Process.ChildProcess._handle.onexit (child_process.js:833:5)
Warning: Command failed: Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: /home/travis/build/eclipsesource/tabris-js-build-template/build/platforms/android/CordovaLib/src/com/eclipsesource/tabris/android/cordova/CordovaPluginOperator.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: /home/travis/build/eclipsesource/tabris-js-build-template/build/platforms/android/CordovaLib/src/com/eclipsesource/tabris/android/cordova/CordovaPluginOperator.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
/home/travis/build/eclipsesource/tabris-js-build-template/build/platforms/android/src/game/for/lina/MainActivity.java:20: error: <identifier> expected
package game.for.lina;
             ^
/home/travis/build/eclipsesource/tabris-js-build-template/build/platforms/android/src/game/for/lina/MainActivity.java:20: error: class, interface, or enum expected
package game.for.lina;
                ^
/home/travis/build/eclipsesource/tabris-js-build-template/build/platforms/android/src/game/for/lina/MainActivity.java:20: error: class, interface, or enum expected
package game.for.lina;
                 ^
/home/travis/build/eclipsesource/tabris-js-build-template/build/platforms/android/build/generated/source/r/debug/game/for/lina/R.java:8: error: <identifier> expected
package game.for.lina;
             ^
/home/travis/build/eclipsesource/tabris-js-build-template/build/platforms/android/build/generated/source/r/debug/game/for/lina/R.java:8: error: class, interface, or enum expected
package game.for.lina;
                ^
/home/travis/build/eclipsesource/tabris-js-build-template/build/platforms/android/build/generated/source/r/debug/game/for/lina/R.java:8: error: class, interface, or enum expected
package game.for.lina;
                 ^
/home/travis/build/eclipsesource/tabris-js-build-template/build/platforms/android/build/generated/source/buildConfig/debug/game/for/lina/BuildConfig.java:4: error: <identifier> expected
package game.for.lina;
             ^
/home/travis/build/eclipsesource/tabris-js-build-template/build/platforms/android/build/generated/source/buildConfig/debug/game/for/lina/BuildConfig.java:4: error: class, interface, or enum expected
package game.for.lina;
                ^
/home/travis/build/eclipsesource/tabris-js-build-template/build/platforms/android/build/generated/source/buildConfig/debug/game/for/lina/BuildConfig.java:4: error: class, interface, or enum expected
package game.for.lina;
                 ^
9 errors

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileDebugJava'.
> Compilation failed; see the compiler error output for details.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

/home/travis/build/eclipsesource/tabris-js-build-template/build/platforms/android/cordova/node_modules/q/q.js:126
                    throw e;
                          ^
Error code 1 for command: /home/travis/build/eclipsesource/tabris-js-build-template/build/platforms/android/gradlew with args: cdvBuildDebug,-b,/home/travis/build/eclipsesource/tabris-js-build-template/build/platforms/android/build.gradle,-Dorg.gradle.daemon=true
Error: /home/travis/build/eclipsesource/tabris-js-build-template/build/platforms/android/cordova/build: Command failed with exit code 8
    at ChildProcess.whenDone (/home/travis/.nvm/v0.10.36/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:131:23)
    at ChildProcess.emit (events.js:98:17)
    at maybeClose (child_process.js:766:16)
    at Process.ChildProcess._handle.onexit (child_process.js:833:5)
 Use --force to continue.

Aborted due to warnings.
travis_time:end:0235232e:start=1432129412829661996,finish=1432129471371683961,duration=58542021965

The command "grunt build deploy" exited with 6.

Done. Your build exited with 1.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:6

github_iconTop GitHub Comments

3reactions
hstaudachercommented, May 21, 2015

Ok, found it. It seems that id="game.for.lina" will be used to generate some Java classes. The for keyword is not allowed in package names in Java. So, just change your id and remove for and everything is working. Will close this issue.

0reactions
hstaudachercommented, May 21, 2015

First impression, build works for iOS. It’s an android problem. Investigating…

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Handle the <Identifier> Expected Error in Java - Rollbar
The expected error in Java occurs when an expression statement is written outside of a constructor/method/instance initialization block.
Read more >
error: <identifier> expected with package com.native
When I try to run the application using the command react-native run-android , it keeps showing this error then exiting the process. /path/to/native/android/app ......
Read more >
How to Fix Java Error – Identifier Expected - Hello Code
The identifier expected error is a compilation error, which means the code doesn't comply with the syntax rules of the Java language. For ......
Read more >
When I try to run - error: main.java:1: <identifier> expected ...
Hello, I just started to mess with B4A, so made a little app to help count a scores in a card game. Wanted...
Read more >
Giving Error of Identifier expected. - java help on CodeGym
The dog should have a String name and int age . Create getters and setters for all the variables of the Dog class....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found