My First Android Simple Program Errors

edited December 2016 in Android Mode

Hi all sweet friends.. i m new here and want to work with Processing Android Mode, i have install "Processing-3.2.3" and also download "Android Mode" and also import "AndroidCapture for processing" , "Video" Library through contribution manager and SDK automatically through processing.. i have window 8.1.. Now when i write the following code i have a lots of errors check snap and givin detail Capture

The Class "PApplet" does not exist, The Class "PImage" does not exist, The function "size(int, int)" does not exist, The variable "width" does not exist, The variable "height" does not exist, The Class "PImage" does not exist, The type processing.core.PImage cannot be resolved. It is indarictly referenced from required.class files

if i write any type of simple code i have the same errors all time, i m new please dear friends help me...Thanks

Tagged:

Answers

  • Please ignore those errors. If you switch into java mode, you will see those errors are go away. I guess it is a bug of Android mode :-?? . Have you run any application in Android mode before? I ask because you need to enable debug mode in your phone. What instructions did you follow to enable your phone?

    There are some instructions here: http://android.processing.org/install.html

    I will suggest to install the ketai library through the Processing library manager. Beside the NFC, all the examples should work out of the box if your phone and Android mode is configure properly.

    Kf

  • edited November 2016

    Yeah i follow the above instructions, and debug mode is enable on my phone(Setting>>Developer options>>USB debugging) now when i try to run the above example i have some warnings and the following error..

  • And thanks a bundle for your precious time and for helping me...

  • Another when i try to run the following example it is ok working new

    but the above problem is still not solve

  • edited November 2016

    The failed happens in the last shot. All other screenshots are warnings. Please post your code. I will suggest using ketai library instead or at least, for this testing part. Run any of the provided examples.

    When posting errors, do not post screenshots. Instead, you can select the text in the console and then press ctrl+c to copy the selection. In the forum, press ctrl+v to paste those errors. Doing this will ensure your errors are 100% readable and other forum goers can find them using the search engine.

    Kf

  • edited November 2016

    Ok thank you... and i also install Ketai the console error is here

    -post-compile:

    -obfuscate:

    -dex: input: C:\Users\LIAQAT~1\AppData\Local\Temp\android306944281296495041sketch\bin\classes input: C:\Users\LIAQAT~1\AppData\Local\Temp\android306944281296495041sketch\libs\AndroidCaptureForProcessing.jar input: C:\Users\LIAQAT~1\AppData\Local\Temp\android306944281296495041sketch\libs\android-support-v4.jar input: C:\Users\LIAQAT~1\AppData\Local\Temp\android306944281296495041sketch\libs\processing-core.jar Pre-Dexing C:\Users\LIAQAT~1\AppData\Local\Temp\android306944281296495041sketch\libs\AndroidCaptureForProcessing.jar -> AndroidCaptureForProcessing-e7c95ce23dc4993f49342adaf149fd98.jar [dx] [dx] PARSE ERROR: [dx] unsupported class file version 52.0 [dx] ...while parsing com/onlylemi/processing/android/capture/AndroidCamera.class [dx] 1 error; aborting

    BUILD FAILED C:\Users\Liaqat Ali\Documents\Processing\modes\AndroidMode\sdk\tools\ant\build.xml:888: The following error occurred while executing this line: C:\Users\Liaqat Ali\Documents\Processing\modes\AndroidMode\sdk\tools\ant\build.xml:890: The following error occurred while executing this line: C:\Users\Liaqat Ali\Documents\Processing\modes\AndroidMode\sdk\tools\ant\build.xml:902: The following error occurred while executing this line: C:\Users\Liaqat Ali\Documents\Processing\modes\AndroidMode\sdk\tools\ant\build.xml:283: null returned: 1

    Total time: 6 seconds

  • edited November 2016

    and the code is here

    import com.onlylemi.processing.android.capture.*;
    
    AndroidCamera ac;
    
    PImage img;
    
    void setup() {
    
      size(720, 480);
    
      ac = new AndroidCamera(width, height, 30);
    
      ac.start();
    
    }
    
    void draw() {
    
      img = ac.getCameraImage();
    
      image(img, 0, 0);
    
    }
    
  • You get the same error with the ketai example?

    Please format your code. Edit your post, select your code and hit ctrl+o.

    Kf

  • edited December 2016
    import ketai.camera.*;
    
    KetaiCamera ac;
    PImage img;
    
    void setup() {
      size(720, 480);
      ac = new KetaiCamera(width, height, 30);
      ac.start();
    }
    
    void draw() {
      img = ac.getCameraImage();
      image(img, 0, 0);
    }
    
  • edited December 2016

    with ketai i have this error

    1. WARNING in C:\Users\Liaqat Ali\AppData\Local\Temp\android4029535535617548524sketch\src\processing\test\cameragettingstarted\CameraGettingStarted.java (at line 9) import ketai.camera.*; ^^^^^^^^^^^^

    The import ketai.camera is never used

    1. ERROR in C:\Users\Liaqat Ali\AppData\Local\Temp\android4029535535617548524sketch\src\processing\test\cameragettingstarted\CameraGettingStarted.java (at line 37) public void setup() { ^^^^^^^

    Duplicate method setup() in type CameraGettingStarted

    1. ERROR in C:\Users\Liaqat Ali\AppData\Local\Temp\android4029535535617548524sketch\src\processing\test\cameragettingstarted\CameraGettingStarted.java (at line 43) public void draw() { ^^^^^^

    Duplicate method draw() in type CameraGettingStarted

    1. ERROR in C:\Users\Liaqat Ali\AppData\Local\Temp\android4029535535617548524sketch\src\processing\test\cameragettingstarted\CameraGettingStarted.java (at line 63) public void setup() { ^^^^^^^

    Duplicate method setup() in type CameraGettingStarted

    1. ERROR in C:\Users\Liaqat Ali\AppData\Local\Temp\android4029535535617548524sketch\src\processing\test\cameragettingstarted\CameraGettingStarted.java (at line 65) ac = new KetaiCamera(width, height, 30); ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

    The constructor KetaiCamera(int, int, int) is undefined

    1. ERROR in C:\Users\Liaqat Ali\AppData\Local\Temp\android4029535535617548524sketch\src\processing\test\cameragettingstarted\CameraGettingStarted.java (at line 69) public void draw() { ^^^^^^

    Duplicate method draw() in type CameraGettingStarted

    1. ERROR in C:\Users\Liaqat Ali\AppData\Local\Temp\android4029535535617548524sketch\src\processing\test\cameragettingstarted\CameraGettingStarted.java (at line 70) img = ac.getCameraImage(); ^^^^^^^^^^^^^^

    The method getCameraImage() is undefined for the type KetaiCamera

    7 problems (6 errors, 1 warning)

    BUILD FAILED C:\Users\LIAQAT~1\AppData\Local\Temp\android4029535535617548524sketch\build.xml:15: The following error occurred while executing this line: C:\Users\LIAQAT~1\AppData\Local\Temp\android4029535535617548524sketch\build.xml:28: Compile failed; see the compiler error output for details.

    Total time: 3 seconds

  • @Khan47===

    -- you cannot get "the same error" using ketai lib as your code does not use anything from ketai

    -- you get "the same error" because you are importing and using android ProcessingCapture class about which the error is "unsupported class version"

    -- what does it means i dont know and not have anytime to see in the jar

    -- in conclusion dont use this lib, use ketai or the native android camera class (ketai camera is only a wrapper for that)

  • Answer ✓

    Please use the ketai examples provided. Do not modify them. If you want to modify them or add to them, create a copy. Provided examples are a way to debug software, specially with Processing as we need to figure out if the problem is the phone, processing, Android SDK or external libraries. If you have more errors running ketai examples, copy and paste the errors below.

    Kf

  • Hi Thanks @akenaton now check the code and error i change above..

  • And Thanks @Kfrajer the provided example work but the camera is too small on center i will try to copy the code and modify it according to my requirements if i found any problem i'll search if not found any answer i'll post it here again..Thanks a bundle for your kindness help.....

  • I m new here and a little bit know about coding, i want to learn here from all of you.... i think i have many mistakes please forgive me.......

  • If you have into any other problems or questions, just come and ask questions here. Doing an online search is a good option too. You will find some libraries in processing are not maintained and I am afraid com.onlylemi.processing.android is one of them.

    Kf

  • edited December 2016

    Hi when i try to run the ketai provided examples it work, but when i copy the example to new skitch it not working, i have this message "Failed to open camera for camera ID: 0:Fail to connect to camera service"

    Also the following example when i run sketch, lunch on the device. but not working..the same message

    ===========================

    import ketai.camera.*;
    
    KetaiCamera cam;
    
        void setup() {
            orientation(LANDSCAPE);
            imageMode(CENTER);
            cam = new KetaiCamera(this, 950, 540, 24);
        }
    
        void draw() {
            if(cam.isStarted())
                image(cam, width/2, height/2);
            else
                cam.start();
        }
    
        void onCameraPreviewEvent(){
            cam.read();
        }
    

    =============================

    This messages is on the console

    Failed to open camera for camera ID: 0:Fail to connect to camera service

    Failed to open camera for camera ID: 0:Fail to connect to camera service

    Failed to open camera for camera ID: 0:Fail to connect to camera service

    Failed to open camera for camera ID: 0:Fail to connect to camera service

  • Answer ✓

    When you create a new sketch, you need to enable the permission to use the camera.

    Kf

  • How i enable the permission to use the camera.

  • How i enable the permission to use the camera.

  • Answer ✓

    On the Processing IDE go to the menu Android >> Sketch Permissions and then select the camera check box.

    Kf

  • Answer ✓

    An alternative:
    You can also manually type it in the manifest.xml file of the android sketch. Press ctrl+k to open the sketch directory, open the manifest.xml file in your favorite text editor and add the lines. You should be able to find the line for camera permission easily on internet.

    Kf

  • edited December 2016

    Wow wonderful! its working now, the provided example is working but when i try to run the above example then skatch is lunched on the device but on my mobile just a white screen and the message is on my mobile "Unfortunately, Android has stopped." and when i click on ok the sketch exit..what is this problem?

Sign In or Register to comment.