Android mode doesn't recognize orientation and fullScreen functions

edited December 2016 in Android Mode

I made my code in normal java mode first and now I'm migrating to Android mode, but for some reason it can't recognise the orientation and fullScreen functions saying "it does not exist"

Answers

  • Does your application run? Processing in Java mode throws error on functions normally recognized in java mode.

    Kf

  • It runs in java mode and I want to convert it to android mode, but it says that orientation, PORTRAIT and fullScreen do not exist in android mode

  • edited December 2016

    the code inside setup gives me an error

        void setup(){
          orientation(PORTRAIT);
    }
    
        void draw(){
    
        }
    
  • @Rophi===

    does it compiles && runs?

  • Just switch to android mode and hit the run button. Do you get an error during compilation?

    Kf

  • it doesn't run and compile in android mode

  • What errors do you get? Copy the error from the console (select error messages, hit ctrl+c) and past it here below, ctrl+v.

    Also what Processing version, OS version, Android API target?

    Ahhh also you need to call size in your first line of setup. Or use fullScreen(). Even better doing it this way:

    Kf

    void settings(){
      fullScreen();
    }
    
    void setup(){  
          orientation(PORTRAIT);
    }
    
    void draw(){   
      background(int(random(256)));
     }
    

    Kf

  • target sdk is 6.0(23), I'm using processing 3.2.3 on linux. The errors are:

        [mkdir] Created dir: /tmp/android4839318928279415303sketch/bin
         [echo] org.eclipse.jdt.core.JDTCompilerAdapter
    
    -set-mode-check:
    
    -set-debug-files:
    
    -check-env:
    Android SDK Tools Revision 25.2.4
    Installed at /home/erlandas/sketchbook/modes/AndroidMode/sdk
    
    -setup:
         [echo] Project Name: sketch_161220b
    Project Type: Application
    
    -set-debug-mode:
    
    -debug-obfuscation-check:
    
    -pre-build:
    
    -build-setup:
    Using latest Build Tools: 25.0.2
         [echo] Resolving Build Target for sketch_161220b...
    Project Target:   Android 6.0
    API level:        23
         [echo] ----------
         [echo] Creating output directories if needed...
        [mkdir] Created dir: /tmp/android4839318928279415303sketch/bin/res
        [mkdir] Created dir: /tmp/android4839318928279415303sketch/bin/rsObj
        [mkdir] Created dir: /tmp/android4839318928279415303sketch/bin/rsLibs
        [mkdir] Created dir: /tmp/android4839318928279415303sketch/gen
        [mkdir] Created dir: /tmp/android4839318928279415303sketch/bin/classes
        [mkdir] Created dir: /tmp/android4839318928279415303sketch/bin/dexedLibs
         [echo] ----------
         [echo] Resolving Dependencies for sketch_161220b...
    Library dependencies:
    No Libraries
    
    ------------------
         [echo] ----------
         [echo] Building Libraries with 'debug'...
       [subant] No sub-builds to iterate on
    
    -code-gen:
    Merging AndroidManifest files into one.
    Manifest merger disabled. Using project manifest only.
         [echo] Handling aidl files...
    No AIDL files to compile.
         [echo] ----------
         [echo] Handling RenderScript files...
         [echo] ----------
         [echo] Handling Resources...
    Generating resource IDs...
         [echo] ----------
         [echo] Handling BuildConfig class...
    Generating BuildConfig class.
    
    -pre-compile:
    
    -compile:
        [javac] Compiling 4 source files to /tmp/android4839318928279415303sketch/bin/classes
    ----------
    1. WARNING in /tmp/android4839318928279415303sketch/src/processing/test/sketch_161220b/MainActivity.java (at line 11)
        import android.support.v4.content.ContextCompat;
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    The import android.support.v4.content.ContextCompat is never used
    ----------
    2. WARNING in /tmp/android4839318928279415303sketch/src/processing/test/sketch_161220b/MainActivity.java (at line 15)
        import android.Manifest;
               ^^^^^^^^^^^^^^^^
    The import android.Manifest is never used
    ----------
    3. WARNING in /tmp/android4839318928279415303sketch/src/processing/test/sketch_161220b/MainActivity.java (at line 49)
        int check;
            ^^^^^
    The value of the local variable check is not used
    ----------
    ----------
    4. WARNING in /tmp/android4839318928279415303sketch/src/processing/test/sketch_161220b/sketch_161220b.java (at line 4)
        import processing.data.*; 
               ^^^^^^^^^^^^^^^
    The import processing.data is never used
    ----------
    5. WARNING in /tmp/android4839318928279415303sketch/src/processing/test/sketch_161220b/sketch_161220b.java (at line 5)
        import processing.event.*; 
               ^^^^^^^^^^^^^^^^
    The import processing.event is never used
    ----------
    6. WARNING in /tmp/android4839318928279415303sketch/src/processing/test/sketch_161220b/sketch_161220b.java (at line 6)
        import processing.opengl.*; 
               ^^^^^^^^^^^^^^^^^
    The import processing.opengl is never used
    ----------
    7. WARNING in /tmp/android4839318928279415303sketch/src/processing/test/sketch_161220b/sketch_161220b.java (at line 8)
        import java.util.HashMap; 
               ^^^^^^^^^^^^^^^^^
    The import java.util.HashMap is never used
    ----------
    8. WARNING in /tmp/android4839318928279415303sketch/src/processing/test/sketch_161220b/sketch_161220b.java (at line 9)
        import java.util.ArrayList; 
               ^^^^^^^^^^^^^^^^^^^
    The import java.util.ArrayList is never used
    ----------
    9. WARNING in /tmp/android4839318928279415303sketch/src/processing/test/sketch_161220b/sketch_161220b.java (at line 10)
        import java.io.File; 
               ^^^^^^^^^^^^
    The import java.io.File is never used
    ----------
    10. WARNING in /tmp/android4839318928279415303sketch/src/processing/test/sketch_161220b/sketch_161220b.java (at line 11)
        import java.io.BufferedReader; 
               ^^^^^^^^^^^^^^^^^^^^^^
    The import java.io.BufferedReader is never used
    ----------
    11. WARNING in /tmp/android4839318928279415303sketch/src/processing/test/sketch_161220b/sketch_161220b.java (at line 12)
        import java.io.PrintWriter; 
               ^^^^^^^^^^^^^^^^^^^
    The import java.io.PrintWriter is never used
    ----------
    12. WARNING in /tmp/android4839318928279415303sketch/src/processing/test/sketch_161220b/sketch_161220b.java (at line 13)
        import java.io.InputStream; 
               ^^^^^^^^^^^^^^^^^^^
    The import java.io.InputStream is never used
    ----------
    13. WARNING in /tmp/android4839318928279415303sketch/src/processing/test/sketch_161220b/sketch_161220b.java (at line 14)
        import java.io.OutputStream; 
               ^^^^^^^^^^^^^^^^^^^^
    The import java.io.OutputStream is never used
    ----------
    14. WARNING in /tmp/android4839318928279415303sketch/src/processing/test/sketch_161220b/sketch_161220b.java (at line 15)
        import java.io.IOException; 
               ^^^^^^^^^^^^^^^^^^^
    The import java.io.IOException is never used
    ----------
    14 problems (14 warnings)
    
    -post-compile:
    
    -obfuscate:
    
    -dex:
    input: /tmp/android4839318928279415303sketch/bin/classes
    input: /tmp/android4839318928279415303sketch/libs/android-support-v4.jar
    input: /tmp/android4839318928279415303sketch/libs/processing-core.jar
    Pre-Dexing /tmp/android4839318928279415303sketch/libs/android-support-v4.jar -> android-support-v4-bdf3ec486bc9f8247ac728ca4b2af593.jar
    Pre-Dexing /tmp/android4839318928279415303sketch/libs/processing-core.jar -> processing-core-cec89870a876e352002a0ed4879dbf6f.jar
    Converting compiled files and external libraries into /tmp/android4839318928279415303sketch/bin/classes.dex...
           [dx] Merged dex #1 (9 defs/5.8KiB)
           [dx] Merged dex #2 (1153 defs/1127.0KiB)
           [dx] Merged dex #3 (160 defs/685.2KiB)
           [dx] Result is 1322 defs/2228.7KiB. Took 0.6s
    
    -crunch:
       [crunch] Crunching PNG Files in source dir: /tmp/android4839318928279415303sketch/res
       [crunch] To destination dir: /tmp/android4839318928279415303sketch/bin/res
       [crunch] Processing image to cache: /tmp/android4839318928279415303sketch/res/drawable-hdpi/icon.png => /tmp/android4839318928279415303sketch/bin/res/drawable-hdpi/icon.png
       [crunch]   (processed image to cache entry /tmp/android4839318928279415303sketch/bin/res/drawable-hdpi/icon.png: 52% size of source)
       [crunch] Processing image to cache: /tmp/android4839318928279415303sketch/res/drawable-ldpi/icon.png => /tmp/android4839318928279415303sketch/bin/res/drawable-ldpi/icon.png
       [crunch]   (processed image to cache entry /tmp/android4839318928279415303sketch/bin/res/drawable-ldpi/icon.png: 0% size of source)
       [crunch] Processing image to cache: /tmp/android4839318928279415303sketch/res/drawable-xhdpi/icon.png => /tmp/android4839318928279415303sketch/bin/res/drawable-xhdpi/icon.png
       [crunch]   (processed image to cache entry /tmp/android4839318928279415303sketch/bin/res/drawable-xhdpi/icon.png: 74% size of source)
       [crunch] Processing image to cache: /tmp/android4839318928279415303sketch/res/drawable-xxhdpi/icon.png => /tmp/android4839318928279415303sketch/bin/res/drawable-xxhdpi/icon.png
       [crunch]   (processed image to cache entry /tmp/android4839318928279415303sketch/bin/res/drawable-xxhdpi/icon.png: 80% size of source)
       [crunch] Processing image to cache: /tmp/android4839318928279415303sketch/res/drawable-xxxhdpi/icon.png => /tmp/android4839318928279415303sketch/bin/res/drawable-xxxhdpi/icon.png
       [crunch]   (processed image to cache entry /tmp/android4839318928279415303sketch/bin/res/drawable-xxxhdpi/icon.png: 95% size of source)
       [crunch] Processing image to cache: /tmp/android4839318928279415303sketch/res/drawable/icon.png => /tmp/android4839318928279415303sketch/bin/res/drawable/icon.png
       [crunch]   (processed image to cache entry /tmp/android4839318928279415303sketch/bin/res/drawable/icon.png: 84% size of source)
       [crunch] Crunched 6 PNG files to update cache
    
    -package-resources:
    Creating full resource package...
         [aapt] Warning: AndroidManifest.xml already defines debuggable (in http://schemas.android.com/apk/res/android); using existing value in manifest.
    
    -package:
    Current build type is different than previous build: forced apkbuilder run.
    Creating sketch_161220b-debug-unaligned.apk and signing it with a debug key...
    
    BUILD FAILED
    /home/erlandas/sketchbook/modes/AndroidMode/sdk/tools/ant/build.xml:958: The following error occurred while executing this line:
    /home/erlandas/sketchbook/modes/AndroidMode/sdk/tools/ant/build.xml:969: The following error occurred while executing this line:
    /home/erlandas/sketchbook/modes/AndroidMode/sdk/tools/ant/build.xml:312: com.android.sdklib.build.ApkCreationException: Failed to create key: Cannot run program "/opt/processing-3.2.3/java/bin/keytool": error=2, No such file or directory
    JAVA_HOME is set to: /opt/processing-3.2.3/java
    Update it if necessary, or manually execute the following command:
    /opt/processing-3.2.3/java/bin/keytool -genkey -alias AndroidDebugKey -keyalg RSA -dname "CN=Android Debug,O=Android,C=US" -validity 10950 -keypass android -keystore /home/erlandas/.android/debug.keystore -storepass android
        at com.android.sdklib.build.ApkBuilder.getDebugKey(ApkBuilder.java:300)
        at com.android.sdklib.build.ApkBuilder.<init>(ApkBuilder.java:392)
        at com.android.ant.ApkBuilderTask.execute(ApkBuilderTask.java:334)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
        at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
        at org.apache.tools.ant.Task.perform(Task.java:348)
        at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:68)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
        at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
        at org.apache.tools.ant.Task.perform(Task.java:348)
        at org.apache.tools.ant.taskdefs.MacroInstance.execute(MacroInstance.java:398)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
        at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
        at org.apache.tools.ant.Task.perform(Task.java:348)
        at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:68)
        at com.android.ant.IfElseTask.execute(IfElseTask.java:124)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
        at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
        at org.apache.tools.ant.Task.perform(Task.java:348)
        at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:68)
        at com.android.ant.IfElseTask.execute(IfElseTask.java:124)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
        at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
        at org.apache.tools.ant.Task.perform(Task.java:348)
        at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:68)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
        at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
        at org.apache.tools.ant.Task.perform(Task.java:348)
        at org.apache.tools.ant.taskdefs.MacroInstance.execute(MacroInstance.java:398)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
        at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
        at org.apache.tools.ant.Task.perform(Task.java:348)
        at org.apache.tools.ant.Target.execute(Target.java:390)
        at org.apache.tools.ant.Target.performTasks(Target.java:411)
        at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
        at processing.mode.android.AndroidBuild.antBuild(AndroidBuild.java:525)
        at processing.mode.android.AndroidBuild.build(AndroidBuild.java:96)
        at processing.mode.android.AndroidMode.handleRunDevice(AndroidMode.java:295)
        at processing.mode.android.AndroidEditor$16.run(AndroidEditor.java:553)
    

    Total time: 20 seconds

  • Notice warning doesn't affect your program. I will focus on the error below. Unfortunately I can't help anymore.

    Kf

    BUILD FAILED /home/erlandas/sketchbook/modes/AndroidMode/sdk/tools/ant/build.xml:958: The following error occurred while executing this line: /home/erlandas/sketchbook/modes/AndroidMode/sdk/tools/ant/build.xml:969: The following error occurred while executing this line: /home/erlandas/sketchbook/modes/AndroidMode/sdk/tools/ant/build.xml:312: com.android.sdklib.build.ApkCreationException: Failed to create key: Cannot run program "/opt/processing-3.2.3/java/bin/keytool": error=2, No such file or directory JAVA_HOME is set to: /opt/processing-3.2.3/java Update it if necessary, or manually execute the following command:

Sign In or Register to comment.