Phonegap Android with PushPlugin compilation failure - android

I'm trying to run a phonegap application with the PushPlugin installed.
I adde the plugin with this command:
$ phonegap local plugin add https://github.com/phonegap-build/PushPlugin
and it went through ok.
I added the PushNotification.js file to my "www" folder and referenced it in index.html.
Then I added some code to handle notifications in my index.js file.
I tried to run the application:
$ phonegap local run android
and got this:
-compile:
[javac] Compiling 8 source files to /Users/nadavelyashiv/Code/PushNotificationSample/platforms/android/bin/classes
[javac] /Users/nadavelyashiv/Code/PushNotificationSample/platforms/android/src/com/plugin/gcm/GCMIntentService.java:96: cannot find symbol
[javac] symbol : method getString(java.lang.String)
[javac] location: class com.plugin.gcm.GCMIntentService
[javac] .setTicker(getString("title"))
[javac] ^
[javac] /Users/nadavelyashiv/Code/PushNotificationSample/platforms/android/src/com/plugin/gcm/GCMIntentService.java:95: cannot find symbol
[javac] symbol : method getString(java.lang.String)
[javac] location: class com.plugin.gcm.GCMIntentService
[javac] .setContentTitle(getString("title"))
[javac] ^
[javac] 2 errors
BUILD FAILED
/usr/local/Cellar/android-sdk/r22.0.4/tools/ant/build.xml:720: The following error occurred while executing this line:
/usr/local/Cellar/android-sdk/r22.0.4/tools/ant/build.xml:734: Compile failed; see the compiler error output for details.
What seems to be the problem here?
Thank you.

Found issue, created a PullRequest on project :
https://github.com/phonegap-build/PushPlugin/pull/83/files
You should update the code of line 95 and 96 of android/com/plugin/gcm/GCMIntentService.java
.setContentTitle(extras.getString("title"))
.setTicker(extras.getString("title"))

Related

Gstreamer Android Development

I'm trying to compile the examples included in GStreamer. I'm following this tutorial
but I can't compile any of the included examples because ant debug give me this error:
-compile:
[javac] Compiling 4 source files to F:\Android\gstreamer\share\gst-sdk\tutorials\android-tutorial-1\bin\classes
[javac] F:\Android\gstreamer\share\gst-sdk\tutorials\android-tutorial-1\src\com\gst_sdk_tutorials\tutorial_1\Tutorial1.java:8: package com.gstreamer does not exist
[javac] import com.gstreamer.GStreamer;
[javac] ^
[javac] F:\Android\gstreamer\share\gst-sdk\tutorials\android-tutorial-1\src\com\gst_sdk_tutorials\tutorial_1\Tutorial1.java:20: cannot find symbol
[javac] symbol : variable GStreamer
[javac] location: class com.gst_sdk_tutorials.tutorial_1.Tutorial1
[javac] GStreamer.init(this);
[javac] ^
[javac] 2 errors
BUILD FAILED
F:\Android\android-sdk\tools\ant\build.xml:716: The following error occurred while executing this line:
F:\Android\android-sdk\tools\ant\build.xml:730: Compile failed; see the compiler error output for details.
Total time: 1 second
I have installed the latest version of android ndk and android sdk, I'm using API 19 and gstreamer 1.7.1 (gstreamer-1.0-android-arm-1.7.1.tar.bz2) downloaded from here; I'm using CygWin64 as required in the tutorial and ANT from Apache. I have also declared all the required local variables.
I can run the first command: android update project -p . -s --target 19
and also the second: ndk-build
If the compiling process is not possible with the command line, where can I get a working version of Eclipse with adt plugins?
I solved: since I'm using Gstreamer 1.7.1 the import line import com.gstreamer.GStreamer; must be changed into import org.freedesktop.gstreamer.GStreamer;.

cordova crosswalk project migration -- error

I am trying to migrate my cordova project to crosswalk.
I am using [following download] (https://download.01.org/crosswalk/releases/crosswalk/android/stable/10.39.235.15/arm/crosswalk-cordova-10.39.235.15-arm.zip) of crosswalk.
My system is having android 4.4 & 4.3 CLI SDK installed.
I want to compile my android app for Android 4.3 (API 18).
"cordova -v" command run output :
4.2.0
"cordova platform version android" command run output :
Installed platforms: android 3.6.4
Available platforms: amazon-fireos, blackberry10, browser, firefoxos, windows, windows8, wp8
I am following following link to Migrate cordova project to crosswalk.
VERSION file contains string :
3.6.3
I am getting following error in "ant dbg" stage. Please suggest how to resolve it ?
"ant dbg" command run output :
debug:
-code-gen:
[mergemanifest] Found Deleted Target File
[mergemanifest] Merging AndroidManifest files into one.
[mergemanifest] Manifest merger disabled. Using project manifest only.
[echo] Handling aidl files...
[aidl] No AIDL files to compile.
[echo] ----------
[echo] Handling RenderScript files...
[echo] ----------
[echo] Handling Resources...
[aapt] Found Deleted Target File
[aapt] Generating resource IDs...
[echo] ----------
[echo] Handling BuildConfig class...
[buildconfig] Generating BuildConfig class.
-pre-compile:
-compile:
[javac] Compiling 43 source files to D:\HTML_genny\Git\cordova_projects\2_cr
osswalk\2\test\platforms\android\CordovaLib\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] D:\HTML_genny\Git\cordova_projects\2_crosswalk\2\test\platforms\andr
oid\CordovaLib\src\com\squareup\okhttp\internal\http\HttpsURLConnectionImpl.java
:347: error: method does not override or implement a method from a supertype
[javac] #Override public void setFixedLengthStreamingMode(long contentLeng
th) {
[javac] ^
[javac] D:\HTML_genny\Git\cordova_projects\2_crosswalk\2\test\platforms\andr
oid\CordovaLib\src\org\apache\cordova\CordovaActivity.java:302: error: cannot fi
nd symbol
[javac] if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
[javac] ^
[javac] symbol: variable KITKAT
[javac] location: class VERSION_CODES
[javac] D:\HTML_genny\Git\cordova_projects\2_crosswalk\2\test\platforms\andr
oid\CordovaLib\src\org\apache\cordova\CordovaActivity.java:309: error: cannot fi
nd symbol
[javac] | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
[javac] ^
[javac] symbol: variable SYSTEM_UI_FLAG_IMMERSIVE_STICKY
[javac] location: class View
[javac] D:\HTML_genny\Git\cordova_projects\2_crosswalk\2\test\platforms\andr
oid\CordovaLib\src\org\apache\cordova\IceCreamCordovaWebViewClient.java:86: erro
r: cannot find symbol
[javac] return android.os.Build.VERSION.SDK_INT >= android.os.Build.
VERSION_CODES.KITKAT && "content".equals(uri.getScheme());
[javac]
^
[javac] symbol: variable KITKAT
[javac] location: class VERSION_CODES
[javac] Note: Some input files use or override a deprecated API.
[javac] Note: Recompile with -Xlint:deprecation for details.
[javac] 4 errors
[javac] 3 warnings
BUILD FAILED
C:\Program Files (x86)\Android\android-sdk\tools\ant\build.xml:720: The followin
g error occurred while executing this line:
C:\Program Files (x86)\Android\android-sdk\tools\ant\build.xml:734: Compile fail
ed; see the compiler error output for details.
Total time: 4 seconds
I've only been using crosswalk 9+cordova 3.5, but I think you should try to use cordova android 3.6.3 instead of 3.6.4 :
cordova platform remove android
cordova platform add android#3.6.3
And then you can follow again the migration guide and replace the cordova-lib with crosswalk-cordova.
And make sure to specify --target "android-19" when building xwalk_core_library.
Ok, I've made a little search about the error message you have.
The error says method setFixedLengthStreamingMode(long contentLength) is not found in HttpsURLConnectionImpl.java.
It seems setFixedLengthStreamingMode is new from java 7, so my guess is you are using an older version of java.
To be sure, run java -version in a terminal.If the output displays Java version 1.6.x, then your problem should be solved after upgrading to java 7 or 8.

Crosswalk cordova migration: CordovaApp.java:33: error: cannot find symbol loadUrl(launchUrl)

I'm doing everything exactely as in instruction: https://crosswalk-project.org/documentation/cordova/migrate_an_application.html
After succesfull build of xwalk_core_library and CordovaLib
Im running cordova build android and facing error:
[javac] Compiling 8 source files to D:\myapp\platforms\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] D:\myapp\platforms\android\src\com\in2circle\fellor\CordovaApp.java:33: error: cannot find symbol
[javac] loadUrl(launchUrl);
[javac] ^
[javac] symbol: variable launchUrl
[javac] location: class CordovaApp
[javac] 1 error
Crosswalk v 9.38.208.10.
Crosswalk v 9.38.208.10 plays well with Cordova 3.5.. I have had installed cordova 4..
Updated to Crosswalk v 10.39.235.9 and problem was solved.
So use Crosswalk v 10 for Cordova v 4.

Facebook SDK - Ant clean release failed

I just download latest facebook SDK from github. I import my facebook SDK into my cordova project, then when I try to build project using cordova build android, I'm always got this error in my terminal. I already done ant clean release, the error still remain. Currently using android sdk 19.
-compile:
[javac] Compiling 94 source files to /Users/MNurdin/Documents/Github/facebook-android-sdk/facebook/bin/classes
[javac] /Users/MNurdin/Documents/Github/facebook-android-sdk/facebook/src/com/facebook/widget/WebDialog.java:349: warning: [deprecation] setSavePassword(boolean) in android.webkit.WebSettings has been deprecated
[javac] webView.getSettings().setSavePassword(false);
[javac] ^
[javac] /Users/MNurdin/Documents/Github/facebook-android-sdk/facebook/src/com/facebook/widget/PickerFragment.java:638: warning: [deprecation] setBackgroundDrawable(android.graphics.drawable.Drawable) in android.view.View has been deprecated
[javac] titleBar.setBackgroundDrawable(titleBarBackground);
[javac] ^
[javac] /Users/MNurdin/Documents/Github/facebook-android-sdk/facebook/src/com/facebook/widget/PickerFragment.java:660: warning: [deprecation] setBackgroundDrawable(android.graphics.drawable.Drawable) in android.view.View has been deprecated
[javac] doneButton.setBackgroundDrawable(doneButtonBackground);
[javac] ^
[javac] 3 warnings
BUILD FAILED
/Applications/android-sdk/tools/ant/build.xml:720: The following error occurred while executing this line:
/Applications/android-sdk/tools/ant/build.xml:734: Compile failed; see the compiler error output for details.
I already search the answers through stackoverflow but still can't get the solution.
I already found the answer. No need to use facebook SDK. I using this one instead facebook SDK from facebook.
https://github.com/phonegap-build/FacebookConnect

include jar in ant compilation android - command line linux

I'm trying to use a jar file in an android application on the linux command line. I've read:
Android include .jar in ant compilation
Which is the same thing but never got a working answer.
Tried this:
How to add external jar libraries to an android project from the command line
but it didn't work, still gave the same error message.
The error is:
-compile:
[javac] Compiling 4 source files to /home/bianca/Documents/sem12012/FIT3140 /code/jackson-example/bin/classes
[javac] messagemain.java:4: package org.codehaus.jackson.map does not exist
[javac] import org.codehaus.jackson.map.ObjectMapper;
[javac] ^
[javac] messagemain.java:21: cannot find symbol
[javac] symbol : class ObjectMapper
[javac] location: class messagemain
[javac] ObjectMapper mapper = new ObjectMapper();
[javac] ^
[javac] messagemain.java:21: cannot find symbol
[javac] symbol : class ObjectMapper
[javac] location: class messagemain
[javac] ObjectMapper mapper = new ObjectMapper();
[javac] ^
[javac] 3 errors
BUILD FAILED
/home/bianca/Downloads/android-sdk-linux/tools/ant/build.xml:602: The following error occurred while executing this line:
/home/bianca/Downloads/android-sdk-linux/tools/ant/build.xml:622: Compile failed; see the compiler error output for details.
So I'm guessing it's a problem with importing the jar. I have the jar stored in ./lib.
EDIT:
I put the jar in libs according to a suggestion in an answer, it gives the same error.
ant.properties is all comments, local.properties and project.properties have not been changed from the automatically generated one. build.xml has not been changed, it's just the automatically generated one.
Use libs/, not lib/. The JAR will automatically be included as part of the compile process, and the JAR's contents will be packaged into your APK.
When building using Eclipse "run", you can have imported JARs even in subfolders of the libs folder - you can, for example, have it in libs/somefodler/somJar.jar. The Ant script shipped with the SDK, however, expects it directly in the libs folder, and not a subfolder.

Categories

Resources