Android ANT Build - Lots of Mopub errors - android

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

Related

How can I add OpenCV library to my react-native project?

I have create a react-native project, I want to do some image processing. I am quite familiar with OpenCV, so I want to use OpenCV library in my project.
I have searched for node module but I can't found it.
So, I tried to implement library with this method likn Android Studio.
1. I have this structure of project :
Project Structure
2. I create Native module from react-native tutorial
Native Module Project Structure
3. When I run :
react-native run-android
I get these errors :
:app:compileDebugJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).
C:\CETIC\OpencvProject2\android\app\src\main\java\com\opencvproject2\MainApplication.java:15: error: cannot find symbol
import com.opencvproject2.opencvcamera;
^
symbol: class opencvcamera
location: package com.opencvproject2
C:\CETIC\OpencvProject2\android\app\src\main\java\com\opencvproject2\opencvcamera\OpenCVCameraModule.java:14: error: package org.opencv.android does not exist
import org.opencv.android.BaseLoaderCallback;
^
C:\CETIC\OpencvProject2\android\app\src\main\java\com\opencvproject2\opencvcamera\OpenCVCameraModule.java:15: error: package org.opencv.android does not exist
import org.opencv.android.CameraBridgeViewBase;
^
C:\CETIC\OpencvProject2\android\app\src\main\java\com\opencvproject2\opencvcamera\OpenCVCameraModule.java:16: error: package org.opencv.android does not exist
import org.opencv.android.LoaderCallbackInterface;
^
C:\CETIC\OpencvProject2\android\app\src\main\java\com\opencvproject2\opencvcamera\OpenCVCameraModule.java:17: error: package org.opencv.android does not exist
import org.opencv.android.OpenCVLoader;
^
C:\CETIC\OpencvProject2\android\app\src\main\java\com\opencvproject2\opencvcamera\OpenCVCameraModule.java:18: error: package org.opencv.android.CameraBridgeViewBase does not exist
import org.opencv.android.CameraBridgeViewBase.CvCameraViewFrame;
^
C:\CETIC\OpencvProject2\android\app\src\main\java\com\opencvproject2\opencvcamera\OpenCVCameraModule.java:19: error: package org.opencv.android.CameraBridgeViewBase does not exist
import org.opencv.android.CameraBridgeViewBase.CvCameraViewListener2;
^
C:\CETIC\OpencvProject2\android\app\src\main\java\com\opencvproject2\opencvcamera\OpenCVCameraModule.java:20: error: package org.opencv.core does not exist
import org.opencv.core.Mat;
^
C:\CETIC\OpencvProject2\android\app\src\main\java\com\opencvproject2\opencvcamera\OpenCVCameraModule.java:21: error: package org.opencv.highgui does not exist
import org.opencv.highgui.Highgui;
^
C:\CETIC\OpencvProject2\android\app\src\main\java\com\opencvproject2\opencvcamera\OpenCVCameraModule.java:37: error: cannot find symbol
public Mat displayImage(String path){
^
symbol: class Mat
location: class OpenCVCameraModule
So my question is : Am I missing something to include OpenCV library to my React-Native project ?

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;.

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.

Compile Android camera application for sdk 1.6

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.

Categories

Resources