Android Server Build Failing - Cannot Find Symbol

90 views
Skip to first unread message

Jerry Nicholson

unread,
Apr 9, 2014, 5:55:23 PM4/9/14
to codenameone...@googlegroups.com
I'm using some native Android code in a NB CN1 project. It builds just fine on my machine but the server build fails. The line numbers refer to import statements for the Android NotificationListenerService as well as subsequent calls to NLS methods. Am I missing something? I created the Interface and the InterfaceImpl and those actually work fine when I simply return a string and don't have the NLS imports or calls to it's methods, so I know how the Native stuff should work. Or do I?

Running java 1.8, Netbeans 8, Android 4.4 kitkat, CN1 is updated, Windows 7 Pro - updated.

Here is the Error logging from the server build:

-compile:
    [javac] Compiling 373 source files to /tmp/build6043403560325340942xxx/Droid2PcAlerts/bin/classes
    [javac] /tmp/build6043403560325340942xxx/Droid2PcAlerts/src/com/mlink/droid2pcalerts/NLSInterfaceImpl.java:4: error: package android.service.notification does not exist
    [javac] import android.service.notification.NotificationListenerService;
    [javac]                                    ^
    [javac] /tmp/build6043403560325340942xxx/Droid2PcAlerts/src/com/mlink/droid2pcalerts/NLSInterfaceImpl.java:5: error: package android.service.notification does not exist
    [javac] import android.service.notification.StatusBarNotification;
    [javac]                                    ^
    [javac] /tmp/build6043403560325340942xxx/Droid2PcAlerts/src/com/mlink/droid2pcalerts/NLSInterfaceImpl.java:7: error: cannot find symbol
    [javac] public class NLSInterfaceImpl extends NotificationListenerService {
    [javac]                                       ^
    [javac]   symbol: class NotificationListenerService
    [javac] /tmp/build6043403560325340942xxx/Droid2PcAlerts/src/com/mlink/droid2pcalerts/NLSInterfaceImpl.java:27: error: cannot find symbol
    [javac]     public void onNotificationPosted(StatusBarNotification sbn) {
    [javac]                                      ^
    [javac]   symbol:   class StatusBarNotification
    [javac]   location: class NLSInterfaceImpl
    [javac] /tmp/build6043403560325340942xxx/Droid2PcAlerts/src/com/mlink/droid2pcalerts/NLSInterfaceImpl.java:35: error: cannot find symbol
    [javac]     public void onNotificationRemoved(StatusBarNotification sbn) {
    [javac]                                       ^
    [javac]   symbol:   class StatusBarNotification
    [javac]   location: class NLSInterfaceImpl
    [javac] /tmp/build6043403560325340942xxx/Droid2PcAlerts/src/com/mlink/droid2pcalerts/NLSInterfaceImpl.java:26: error: method does not override or implement a method from a supertype
    [javac]     @Override
    [javac]     ^
    [javac] /tmp/build6043403560325340942xxx/Droid2PcAlerts/src/com/mlink/droid2pcalerts/NLSInterfaceImpl.java:34: error: method does not override or implement a method from a supertype
    [javac]     @Override
    [javac]     ^
    [javac] Note: Some input files use or override a deprecated API.
    [javac] Note: Recompile with -Xlint:deprecation for details.
    [javac] Note: Some input files use unchecked or unsafe operations.
    [javac] Note: Recompile with -Xlint:unchecked for details.
    [javac] 7 errors

BUILD FAILED
/home/ec2-user/android-sdk/tools/ant/build.xml:720: The following error occurred while executing this line:
/home/ec2-user/android-sdk/tools/ant/build.xml:734: Compile failed; see the compiler error output for details.

Shai Almog

unread,
Apr 10, 2014, 1:38:02 AM4/10/14
to codenameone...@googlegroups.com
You can use the notify methods in Display which allow you to popup a notification without native code.
However, if you really need that then you need to change the target SDK level which is currently 11 or 14 depending on your config to 18. This can be done by adding the build argument android.targetSDKVersion=18
Notice that since we don't test this target level things might fail, its possible that the JavaScript/WebBrowser bridge will fail for that target level.

Jerry Nicholson

unread,
Apr 10, 2014, 8:56:56 AM4/10/14
to codenameone...@googlegroups.com
Okay, thanks, Shai. I'd rather not use native methods but now I want to see if it works! Will also check out Display.

And thank you for your usual quick and informative support! Good support is easily 50% of a successful tech business.

Jerry Nicholson

unread,
Apr 10, 2014, 10:45:20 AM4/10/14
to codenameone...@googlegroups.com

It looks like Display won't let me do what I need to do, which is GET the current notifications, not add one.

Shai Almog

unread,
Apr 10, 2014, 1:39:48 PM4/10/14
to codenameone...@googlegroups.com
Yes we don't expose that. Its a bit platform specific.
Reply all
Reply to author
Forward
0 new messages