Notifications plugin build issue

Hello everybody!
 
I downloaded the Notifications plugin and run the build.sh. It works fine until

[android] CORONA\_PATH: ../../../../../Applications/CoronaEnterprise USAGE: build.plugin.sh USAGE: build.plugin.sh android\_sdk\_path USAGE: build.plugin.sh android\_sdk\_path corona\_enterprise\_path android\_sdk\_path: Path to the root Android SDK directory. corona\_enterprise\_path: Path to the CoronaEnterprise directory. Exiting due to errors (above) Exiting due to errors (above)

Have any ideas?

Hi komkov,

You likely do not have your ANDROID_SDK environment variable defined. Edit ~/.bash_profile and add the following lines:

export ANDROID\_SDK=/path/to/android/sdk export ANDROID\_NDK=/path/to/android/ndk

If you do not have hidden files displayed, you can open Terminal and type “open ~/.bash_profile” to edit it.

You will also need some other Android-specific tools in your path. Your bash profile should look something like this, at minimum:

export PATH="$PATH\ :/usr/local/bin\ :/opt/local/bin\ :$HOME/External/android-sdk-mac\_86/build-tools/21.1.2\ :$HOME/External/android-sdk-mac\_86/platform-tools\ :$HOME/External/android-sdk-mac\_86/tools" export ANDROID\_NDK="$HOME/External/android-ndk-r10d" export ANDROID\_SDK="$HOME/External/android-sdk-mac\_86"

Hi Michael,

Thanx for your response. I added ANDROID_NDK & ANDROID_SDK variables to my bash_profile. Now I get next error:

-compile: [javac] Compiling 3 source files to /Users/komkov/Desktop/plugins-source-notifications-master/android/bin/classes [javac] warning: [options] source value 1.5 is obsolete and will be removed in a future release [javac] warning: [options] target value 1.5 is obsolete and will be removed in a future release [javac] warning: [options] To suppress warnings about obsolete options, use -Xlint:-options. [javac] /Users/komkov/Desktop/plugins-source-notifications-master/android/src/com/ansca/corona/Bridge.java:38: error: cannot find symbol [javac] int id = notificationSchedule(L, index); [javac] ^ [javac] symbol: method notificationSchedule(LuaState,int) [javac] location: class Bridge [javac] 1 error [javac] 3 warnings BUILD FAILED /Users/komkov/Desktop/plugins-source-notifications-master/android/build.plugin.xml:99: The following error occurred while executing this line: /Users/komkov/Documents/Android SDK/tools/ant/build.xml:720: The following error occurred while executing this line: /Users/komkov/Documents/Android SDK/tools/ant/build.xml:734: Compile failed; see the compiler error output for details. Total time: 1 second Exiting due to errors (above) Exiting due to errors (above) Exiting due to errors (above)

I’m novice to developing for Android. Can you explain me how to build plugins step-by-step. Maybe I do something wrong initially.

Hi komkov,

Regarding that second issue, since you’ve run the build script past this point, verify that you have a file called “Corona.jar” in the directory:

plugins-source-notifications-master/android/libs

The definition of the notificationSchedule() method should be in that jar file.

If it’s not there, I’d verify that you’re Corona Enterprise path in that script is correct.

Hi ajaymccaleb-work,

Thanx for your response. I have Corona.jar file in plugins-source-notifications-master/android/libs

My path to Corona Enterprise is /Applications/CoronaEnterprise/

My bash_profile is

... export ANDROID\_HOME="/Users/komkov/Documents/Android SDK" export ANDROID\_SDK="/Users/komkov/Documents/Android SDK" export ANDROID\_NDK="/Users/komkov/Documents/Android NDK" export PATH=${PATH}:$ANDROID\_HOME/tools:$ANDROID\_HOME/platform-tools:$ANDROID\_HOME/build-tools/22.0.1

What’s wrong here?

Try changing your paths to the Android SDK and NDK such that they don’t have spaces. As a general rule, spaces in file names are usually a bad idea as they’ll give some undefined behavior on the command line.

Yes, I already remove spaces, but the problem is the same. Do you have more ideas?

Next, verify that there’s a .class file called “NativeToJavaBridge.class” inside Corona.jar. You can do this in the terminal with the commands:

cd [to the libs directory mentioned before]
unzip Corona.jar
find . | grep -i Native

If there isn’t a NativeToJavaBridge.class file, try upgrading your Enterprise installation to the latest daily build.

Regarding spaces, wrap all your variable/paths in quotes.

Good:

export PATH="${PATH}:$ANDROID\_HOME/tools:$ANDROID\_HOME/platform-tools:$ANDROID\_HOME/build-tools/22.0.1"

Bad:

export PATH=${PATH}:$ANDROID\_HOME/tools:$ANDROID\_HOME/platform-tools:$ANDROID\_HOME/build-tools/22.0.1

http://tldp.org/LDP/abs/html/quotingvar.html

I have “NativeToJavaBridge.class” file.

$ find . | grep -i Native ./com/ansca/corona/JavaToNativeShim.class ./com/ansca/corona/NativeToJavaBridge$1$1.class ./com/ansca/corona/NativeToJavaBridge$1.class ./com/ansca/corona/NativeToJavaBridge$2.class ./com/ansca/corona/NativeToJavaBridge$LoadBitmapResult.class ./com/ansca/corona/NativeToJavaBridge.class

Thanx for a helpful article, but the problem is the same.

Hmm… ok. Next you could try investigating your Java tools.

First, you should see if you have Java 6 at the least. Judging from the warnings you were getting, it looks like you might have Java 5.

Type javac -version at the command line. If you’re output is like the following, then you should have the latest Java 6 JDK installed.

$ javac -version javac 1.6.0\_65

If you don’t have Java JDK 6, From Oracle’s FAQ page:

For Java versions 6 and below, Apple supplies their own version of Java. For Mac OS X 10.6 and below, use the Software Update feature (available on the Apple menu) to check that you have the most up-to-date version of Java 6 for your Mac. For issues related to Apple Java 6 on Mac, contact Apple Support.

After getting the latest version of Java JDK 6 installed, verify that your JAVA_HOME environment variable is set correctly. Do this by typing $JAVA_HOME at the command line. The output should be like the following:

$ $JAVA\_HOME -bash: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home: is a directory 

If this isn’t correct, change it in your .bash_profile as mentioned before.

Assuming all this is now correct, try compiling the plugin again and see if it works.

Now my Java version is 1.8.0_40:

$ javac -version javac 1.8.0\_40

I added $JAVA_HOME to my bash_profile & now my version is 1.6.0_65:

$ javac -version javac 1.6.0\_65

Now I get next error:

... [javac] warning: java/lang/annotation/RetentionPolicy.class(java/lang/annotation:RetentionPolicy.class): major version 51 is newer than 50, the highest major version supported by this compiler. [javac] It is recommended that the compiler be upgraded. [javac] /Users/komkov/Desktop/plugins-source-notifications-master/android/src/com/ansca/corona/Bridge.java:38: cannot find symbol [javac] symbol : method notificationSchedule(com.naef.jnlua.LuaState,int) [javac] location: class com.ansca.corona.Bridge [javac] int id = notificationSchedule(L, index); [javac] ^ [javac] warning: java/io/Serializable.class(java/io:Serializable.class): major version 51 is newer than 50, the highest major version supported by this compiler. [javac] It is recommended that the compiler be upgraded. ... [javac] 1 error [javac] 20 warnings BUILD FAILED

Michael, ajaymccaleb-work, do you have more ideas?

Problem was solved. I had a trial account. After payment plugin successfully compiled.

Michael, ajaymccaleb-work thank you for your help & I’m sorry that took your time on such a trifle :) 

Glad you got it fixed. :slight_smile:

We’ll keep an eye out for similar reports. Thank you for posting back with what the problem was.

Hi komkov,

You likely do not have your ANDROID_SDK environment variable defined. Edit ~/.bash_profile and add the following lines:

export ANDROID\_SDK=/path/to/android/sdk export ANDROID\_NDK=/path/to/android/ndk

If you do not have hidden files displayed, you can open Terminal and type “open ~/.bash_profile” to edit it.

You will also need some other Android-specific tools in your path. Your bash profile should look something like this, at minimum:

export PATH="$PATH\ :/usr/local/bin\ :/opt/local/bin\ :$HOME/External/android-sdk-mac\_86/build-tools/21.1.2\ :$HOME/External/android-sdk-mac\_86/platform-tools\ :$HOME/External/android-sdk-mac\_86/tools" export ANDROID\_NDK="$HOME/External/android-ndk-r10d" export ANDROID\_SDK="$HOME/External/android-sdk-mac\_86"

Hi Michael,

Thanx for your response. I added ANDROID_NDK & ANDROID_SDK variables to my bash_profile. Now I get next error:

-compile: [javac] Compiling 3 source files to /Users/komkov/Desktop/plugins-source-notifications-master/android/bin/classes [javac] warning: [options] source value 1.5 is obsolete and will be removed in a future release [javac] warning: [options] target value 1.5 is obsolete and will be removed in a future release [javac] warning: [options] To suppress warnings about obsolete options, use -Xlint:-options. [javac] /Users/komkov/Desktop/plugins-source-notifications-master/android/src/com/ansca/corona/Bridge.java:38: error: cannot find symbol [javac] int id = notificationSchedule(L, index); [javac] ^ [javac] symbol: method notificationSchedule(LuaState,int) [javac] location: class Bridge [javac] 1 error [javac] 3 warnings BUILD FAILED /Users/komkov/Desktop/plugins-source-notifications-master/android/build.plugin.xml:99: The following error occurred while executing this line: /Users/komkov/Documents/Android SDK/tools/ant/build.xml:720: The following error occurred while executing this line: /Users/komkov/Documents/Android SDK/tools/ant/build.xml:734: Compile failed; see the compiler error output for details. Total time: 1 second Exiting due to errors (above) Exiting due to errors (above) Exiting due to errors (above)

I’m novice to developing for Android. Can you explain me how to build plugins step-by-step. Maybe I do something wrong initially.

Hi komkov,

Regarding that second issue, since you’ve run the build script past this point, verify that you have a file called “Corona.jar” in the directory:

plugins-source-notifications-master/android/libs

The definition of the notificationSchedule() method should be in that jar file.

If it’s not there, I’d verify that you’re Corona Enterprise path in that script is correct.

Hi ajaymccaleb-work,

Thanx for your response. I have Corona.jar file in plugins-source-notifications-master/android/libs

My path to Corona Enterprise is /Applications/CoronaEnterprise/

My bash_profile is

... export ANDROID\_HOME="/Users/komkov/Documents/Android SDK" export ANDROID\_SDK="/Users/komkov/Documents/Android SDK" export ANDROID\_NDK="/Users/komkov/Documents/Android NDK" export PATH=${PATH}:$ANDROID\_HOME/tools:$ANDROID\_HOME/platform-tools:$ANDROID\_HOME/build-tools/22.0.1

What’s wrong here?

Try changing your paths to the Android SDK and NDK such that they don’t have spaces. As a general rule, spaces in file names are usually a bad idea as they’ll give some undefined behavior on the command line.