Compile Android camera application for sdk 1.6 - android

I am trying to compile and run the Android Camera for sdk 1.6 (also called API level 4 or Donut release).
While there is no minSdkVersion in the AndroidManifest, it clearly does not run on a donut device. In fact, if compiled with sdk 2.2 the camera will crash with a NoSuchMethodError execption on an avd or a G1 with sdk 1.6.
I tried also checking out the [donut-release] tag, but, strangely, it won't even compile giving many errors like:
[javac] /home/mrucci/camtest2/src/com/android/camera/ImageManager.java:41: cannot find symbol
[javac] symbol : class DrmStore
[javac] location: package android.provider
[javac] import android.provider.DrmStore;
[javac] ^
[javac] /home/mrucci/camtest2/src/com/android/camera/Util.java:32: cannot find symbol
[javac] symbol : class MediaMetadataRetriever
[javac] location: package android.media
[javac] import android.media.MediaMetadataRetriever;
[javac] ^
[javac] /home/mrucci/camtest2/src/com/android/camera/MenuHelper.java:29: cannot find symbol
[javac] symbol : class ExifInterface
[javac] location: package android.media
[javac] import android.media.ExifInterface;
....
[javac] ^
[javac] /home/mrucci/camtest2/src/com/android/camera/ActionMenuButton.java:81: cannot find symbol
[javac] symbol : variable mScrollX
[javac] location: class com.android.camera.ActionMenuButton
[javac] mScrollX + mRight - mLeft),
[javac] ^
[javac] /home/mrucci/camtest2/src/com/android/camera/ActionMenuButton.java:81: cannot find symbol
[javac] symbol : variable mRight
[javac] location: class com.android.camera.ActionMenuButton
[javac] mScrollX + mRight - mLeft),
In particular, I really do not understand why ExifInterface is used in the "donut" tag when it has been introduced since API level 5. Am I missing something?

Some of these classes are hidden from the sdk with the #hide annotation. So you can only build if you pull down and build all of aosp.
https://github.com/android/platform_frameworks_base/blob/donut-release/media/java/android/media/MediaMetadataRetriever.java

Are you trying to use the latest revision? It takes advantage of a whole bunch of new APIs and would be very difficult to get working on an API 4 levels below its target. The revision at here, however, should compile just fine.

Related

Cordova Android project doesn't compile

Cordova version: 4.3.0
java version "1.8.0_40" 64bit
OS X 10.10.2
Ant version: 1.9.4
Target android SDK I'm using is 19.
When I run 'ant release' in the platforms/android/CordovaLib folder I get the following output with error:
Buildfile: .../platforms/android/CordovaLib/build.xml
-set-mode-check:
-set-release-mode:
-release-obfuscation-check:
[echo] proguard.config is ${proguard.config}
-pre-build:
-check-env:
[checkenv] Android SDK Tools Revision 24.1.2
[checkenv] Installed at /Users/.../Library/Android/sdk
-setup:
[echo] Project Name: MainActivity
[gettype] Project Type: Android Library
-build-setup:
[getbuildtools] Using latest Build Tools: 21.1.2
[echo] Resolving Build Target for MainActivity...
[gettarget] Project Target: Android 4.4.2
[gettarget] API level: 19
[echo] ----------
[echo] Creating output directories if needed...
[mkdir] Created dir: .../platforms/android/CordovaLib/bin/rsObj
[mkdir] Created dir: .../platforms/android/CordovaLib/bin/rsLibs
[echo] ----------
[echo] Resolving Dependencies for MainActivity...
[dependency] Library dependencies:
[dependency] No Libraries
[dependency]
[dependency] ------------------
[echo] ----------
[echo] Building Libraries with 'release'...
[subant] No sub-builds to iterate on
-code-gen:
[mergemanifest] No changes in the AndroidManifest files.
[echo] Handling aidl files...
[aidl] No AIDL files to compile.
[echo] ----------
[echo] Handling RenderScript files...
[echo] ----------
[echo] Handling Resources...
[aapt] No changed resources. R.java and Manifest.java untouched.
[echo] ----------
[echo] Handling BuildConfig class...
[buildconfig] Generating BuildConfig class.
-pre-compile:
-compile:
[javac] Compiling 98 source files to .../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] .../platforms/android/CordovaLib/src/org/apache/cordova/CordovaWebViewClient.java:35: error: cannot find symbol
[javac] import android.webkit.ClientCertRequest;
[javac] ^
[javac] symbol: class ClientCertRequest
[javac] location: package android.webkit
[javac] .../platforms/android/CordovaLib/src/org/apache/cordova/CordovaWebViewClient.java:145: error: cannot find symbol
[javac] public void onReceivedClientCertRequest (WebView view, ClientCertRequest request)
[javac] ^
[javac] symbol: class ClientCertRequest
[javac] location: class CordovaWebViewClient
[javac] .../platforms/android/CordovaLib/src/org/apache/cordova/CordovaChromeClient.java:342: error: cannot find symbol
[javac] public boolean onShowFileChooser(WebView webView, final ValueCallback<Uri[]> filePathsCallback, final WebChromeClient.FileChooserParams fileChooserParams) {
[javac] ^
[javac] symbol: class FileChooserParams
[javac] location: class WebChromeClient
[javac] .../platforms/android/CordovaLib/src/org/apache/cordova/CordovaClientCertRequest.java:25: error: cannot find symbol
[javac] import android.webkit.ClientCertRequest;
[javac] ^
[javac] symbol: class ClientCertRequest
[javac] location: package android.webkit
[javac] .../platforms/android/CordovaLib/src/org/apache/cordova/CordovaClientCertRequest.java:32: error: cannot find symbol
[javac] private final ClientCertRequest request;
[javac] ^
[javac] symbol: class ClientCertRequest
[javac] location: class CordovaClientCertRequest
[javac] .../platforms/android/CordovaLib/src/org/apache/cordova/CordovaClientCertRequest.java:34: error: cannot find symbol
[javac] public CordovaClientCertRequest(ClientCertRequest request) {
[javac] ^
[javac] symbol: class ClientCertRequest
[javac] location: class CordovaClientCertRequest
[javac] .../platforms/android/CordovaLib/src/org/apache/cordova/CordovaChromeClient.java:340: error: cannot find symbol
[javac] #TargetApi(Build.VERSION_CODES.LOLLIPOP)
[javac] ^
[javac] symbol: variable LOLLIPOP
[javac] location: class VERSION_CODES
[javac] .../platforms/android/CordovaLib/src/org/apache/cordova/CordovaWebView.java:197: error: cannot find symbol
[javac] if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
[javac] ^
[javac] symbol: variable LOLLIPOP
[javac] location: class VERSION_CODES
[javac] .../platforms/android/CordovaLib/src/org/apache/cordova/CordovaWebView.java:200: error: cannot find symbol
[javac] cookieManager.setAcceptThirdPartyCookies(this, true);
[javac] ^
[javac] symbol: method setAcceptThirdPartyCookies(CordovaWebView,boolean)
[javac] location: variable cookieManager of type CookieManager
[javac] .../platforms/android/CordovaLib/src/org/apache/cordova/CordovaWebViewClient.java:143: error: method does not override or implement a method from a supertype
[javac] #Override
[javac] ^
[javac] .../platforms/android/CordovaLib/src/org/apache/cordova/CordovaChromeClient.java:341: error: method does not override or implement a method from a supertype
[javac] #Override
[javac] ^
[javac] .../platforms/android/CordovaLib/src/org/apache/cordova/CordovaChromeClient.java:348: error: cannot find symbol
[javac] Uri[] result = WebChromeClient.FileChooserParams.parseResult(resultCode, intent);
[javac] ^
[javac] symbol: variable FileChooserParams
[javac] location: class WebChromeClient
[javac] Note: Some input files use or override a deprecated API.
[javac] Note: Recompile with -Xlint:deprecation for details.
[javac] 12 errors
[javac] 3 warnings
BUILD FAILED
/Users/.../Library/Android/sdk/tools/ant/build.xml:720: The following error occurred while executing this line:
/Users/.../Library/Android/sdk/tools/ant/build.xml:734: Compile failed; see the compiler error output for details.
Total time: 3 seconds
android, ant, java are all in in the PATH.
I've tried fiddling with the target sdks and tried downloading different versions but I've run out of ideas. Any help would be much appreciated.
AndroidManifest - from CordovaLib folder:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.apache.cordova" android:versionName="1.0" android:versionCode="1">
<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="19" />
</manifest>
Don't understand why it refers to LOLLIPOP in the error message and then why can't it find it since it's installed.
I think it's because the Cordova 4.3.0 has referenced the android.webkit.ClientCertRequest, which is newly added in API level 21.
FYI: https://developer.android.com/reference/android/webkit/ClientCertRequest.html
Install Android build tools version 21 and 22 from SDK Manager.
Once the build tools are installed, remove the platforms folder inside your app.
Go to Cordova and add the android platform again (using cordova platform add android command).
Once the platform is reinstalled, rebuild the app (using cordova build command) and it will build successfully
Your Cordova is too high to work with Android Api 19. Meaning it's newer so it references libraries that Api 19 doesn't have and gives an error. So you need to dumb it down a little bit.
Uninstall it:
sudo npm uninstall -g cordova
And then install an older version of cordova that works well with Api 19:
sudo npm install -g cordova#4.0.0
and now do everything again from scratch. "cordova create blabla", "cordova
platform add android", "cordova run android", etc.
To get a list of cordova versions do:
npm view cordova versions
But I know that 4.0.0 will work with Api 19 since I had the same problem.

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.

Android ANT Build - Lots of Mopub errors

I'm trying to create a script to automate the signed exportation of my android apps (to avoid manual work when I release an update to all my apps).
I've followed this tutorial: http://www.enterra-inc.com/techzone/using_ant_android_applications_building/
and others, very similar to this one.
I'm testing with 1 project by now, which includes mopub-sdk library, among others and I get a lot of errors, like this one (only with ANT build):
[javac] D:\Documents\Applications\Eclipse\Projects\mopub-sdk\src\test\java\com\mopub\mobileads\AdFetcherTest.java:62: error: static import only from classes and interfaces
[javac] import static org.mockito.Mockito.verify;
[javac] ^
[javac] D:\Documents\Applications\Eclipse\Projects\mopub-sdk\src\test\java\com\mopub\mobileads\AdFetcherTest.java:64: error: cannot find symbol
[javac] #RunWith(SdkTestRunner.class)
[javac] ^
[javac] symbol: class RunWith
[javac] D:\Documents\Applications\Eclipse\Projects\mopub-sdk\src\test\java\com\mopub\mobileads\AdLoadTaskTest.java:41: error: package org.junit does not exist
[javac] import org.junit.Before;
[javac] ^
[javac] D:\Documents\Applications\Eclipse\Projects\mopub-sdk\src\test\java\com\mopub\mobileads\AdLoadTaskTest.java:42: error: package org.junit does not exist
[javac] import org.junit.Test;
[javac] ^
[javac] D:\Documents\Applications\Eclipse\Projects\mopub-sdk\src\test\java\com\mopub\mobileads\AdLoadTaskTest.java:43: error: package org.junit.runner does not exist
[javac] import org.junit.runner.RunWith;
[javac] ^
[javac] D:\Documents\Applications\Eclipse\Projects\mopub-sdk\src\test\java\com\mopub\mobileads\AdLoadTaskTest.java:58: error: package org.fest.assertions.api does not exist
[javac] import static org.fest.assertions.api.Assertions.assertThat;
[javac] ^
[javac] D:\Documents\Applications\Eclipse\Projects\mopub-sdk\src\test\java\com\mopub\mobileads\AdLoadTaskTest.java:58: error: static import only from classes and interfaces
When I compile with Eclipse, everything is fine.
I think I did everything OK, but there is only 1 thing that is bothering me.
For some reason, when I imported the mopub-sdk project, it showed src/main/java directory instead of just src like the rest of the projects.
So, my question is:
1) How can I solve these errors so I can finally build automatically all my apps.
2) It the folder structure of mopub-sdk is the cause of the problem: how can I solve it?
UPDATE:
While trying to reimport the mopub-sdk project, I'm getting this error.
I found the solution.
The problem was finally mopub-sdk library project and the problems at the import stage.
I fixed the nested directory issue within the src/ folder and the build was successful.
To fix our ANT build remove the 'test' folder under src and the compile errors in ANT went away.
Specifically the files in this part of the downloaded SDK:
https://github.com/mopub/mopub-android-sdk/tree/master/mopub-sdk/src/test

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

Phonegap Android with PushPlugin compilation failure

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"))

Categories

Resources