Only API 26 for Processing ?

edited October 2017 in Android Mode

Hello,

Sorry for my english, I am French and I use Google traduction, it should not be very effective, so thank you very much to read me !

Here is my problem: Since 3 days, I am fighting with Processing and Android Studio, because I want to export an application apk on my phone (samsung galaxy s3, Android 4.1.1, API16).

I click "Export Android Project", and I open Android Studio, then I choose "Import Project", and "Build, Generate Signed APK", and I copy/paste my app.APK on my phone. When I click on, there is an error message "Probleme lors de l'analyse de l'ensemble".

On the Internet, I saw other people who have this problem, but they were unable to resolve it, because, according to them, that is the API version of SDK for Processing (Android 8.0.0, API 26!) which is too recent for this phone(Android 4.1.1 API 15 or 16). So the only way is to change my phone? There is maybe another solution please ?! Thank you !

Edit : My Processing Version is 3.3.6 and I am on Windows 7

Answers

  • Questions:

    Is this your first application?

    Did you deploy your application like this before, maybe using an older version of Android Mode for Processing?

    From what I understand, you wrote the application in Processing and you exported to AS. Were you able to run the app in your phone directly from Processing?

    I would like to know if the application is running properly. To do so I suggest using a more recent phone. An alternative is to use an emulator. The second problem is API version conflict, which it is indeed hard to reproduce as most people won't have a device similar to your current one. My suggestion is to build a small scale sample code that could reproduce the problem and share it here in the forum. Then, some people in the forum can test your code in their devices and provide some suggestions.

    Kf

  • Thanks you for your answer kfrajer, Yes it is my first Android application! It seems that there is only one version of Android Mode for Processing (in any case, the Processing contribution manager only proposes "Android Mode 4.0") Unfortunaly, I am not able to run the app in my phone directly from Processing, because I need a driver for my device, and I did not manage to install it. I may be retry ? And I will install an emulator as you propose. For the moment, my code is not very elaborate, so I may be waiting before share it in the forum, but I would probably do that if it still does not work ! Thanks for your reply !

  • @Corentin===

    • what version of the android mode are you using???

    • p5 android mode uses (i dont know for 4. but probably yes) appCompat v7: so i dont think that you have to change your phone !!!! - What is your minSdk target (in your Manifest)???

    • i dont understand your "driver" problem: if it does not work with P5 what is the difference with AS???

  • Hello akenaton, I actually use the Android Mode 4.0 (the only version that appears in the "Processing contribution manager") New since yesterday : my phone appears in the menu "Android => Devices" ! So now I can try to export my sketch directly on my connected phone, but it still does not work :

    In the manifest, I have tested a lot of minSdk target values: 1, 8,14, 16, 26, and for all these values, I always have the same message when I do "Sketch => Run on Device" : Failure [INSTALL_FAILED_OLDER_SDK]

    The driver problem was the same for p5 (p5 means Processing ?) and AS, because That was not possible to connect my phone to these applications, so I did "Build => Build APK" and I copied the file on my phone. Thank you for your reply !

  • edited October 2017

    @Corentin===

    ok, now i understand though i don't think it was a good idea to export your build apk to AS... As for your message error, i am not sure because since now i never used 4.0 mode, yet this message usually means that the minSDK targetted value is wrong; try to verify in the apk folder what is this value. You can find it in the app folder, build.gradle. Other thing : put here your Manifest.

  • edited October 2017

    That is very interesting, I opened the "build.gradle" file and here is an excerpt:

    applicationId "processing.test.test_android" minSdkVersion 17 targetSdkVersion 26 versionCode 1 versionName "1.0"

    However, I settled the value of the minSdkVersion to 14!

    Here is the Manifest :

    uses-sdk android:minSdkVersion="14" android:targetSdkVersion="26"
    application android:icon="@drawable/icon" android:label=""
        activity android:name=".MainActivity" android:theme="@style/Theme.AppCompat.Light.NoActionBar.FullScreen"
            intent-filter
    

    It looks like Processing did not heed my minSdkVersion, and I don't understand for what it use minSdkVersion 17.

    thank you for your reply, I think we are approaching the solution !

    Edit : sorry but I think the code did not appear well, so I just put an extract of the manifest and build.gradle.

  • Answer ✓

    It wooorks ! It woooorks ! I'll be able to get out of my House ! Thanks a lot for your help, akenaton and kfrajer! I will describe the solution : you have to change the minSdkVersion to 9 in the manifest, but also open the build.gradle in the app folder, and then change the minSdkVersion to 9 (8 doesn't work for me), and after that you can export to android project, and make an APK with Android Studio for exemple.

  • Answer ✓

    @Corentin===

    ok, it s exactly what i thought, though i cannot see any reason why P5 changes the value for minSdk fixed by the manifest... put answered for others.

  • Where is the build.gradle file ? I only see the AndroidManifest.xml.

    I´ve been tryng to install an android app made in processing for a phone that has 4.1.2 version.

    Im using SDK that i´ve downloaded from android studio. Tested the app in modern phones and it works (5 and above).

    Test it in 4.1.2 and 2.1 phones and it does not work.

    Put 9 in minSdkVersion in the android manifest. Tryed to change targetSdkVersion to 15 but it keeps changin on its own.

  • To get the gradle file, I believe you need to export the application. You go to the exported folder and it should be there. You only see the manifest when you run your code from the PDE in Android mode. The gradle file, and all other files and folders generated in the building process, are created in a temp folder and you dont see it unless you search for it.

    Related to prev Android API versions, from the following link:

    http://andrescolubri.net/androidbook/chapter-1/index.html

    Note: Version 4.0 of Android mode requires Android version 8.0 (Oreo), corresponding to API level 26. The mode’s automatic SDK download will retrieve this version from the Google servers. Pre-releases of Android mode, as well as older, unsupported versions, are no longer available through the CM, but rather are deposited on the GitHub releases page and can be installed manually by downloading the corresponding file and extracting it into the Modes folder in Processing’s sketchbook.

    However, it seems, from prev posts that if you export the code to AS, and you change the gradle file and you app's manifest, you are able to run it in older Android APIs, which means the minSDK suggested by Andres in his book is not strict. I can only guess you need a min API level of 26 if you want to work with Wallpapers, VR and smart watches.

    Please note there are two gradle files, one at the root level of your exported app and the other one is in one of the nested folders. Not sure which gradle file you need to change. just open both and see which one you need to change. Those two gradle files are different, if I remember correctly.

    Kf

  • @Aurelian24===

    in order to get the gradle file ("build.gradle") with P5 you have to export your Pde to android; in the created folder you go to "app" then to build.graddle that you can open as a text file. Here you can see what version of compiler is used and what version of build tools: probably 26 and usually (recommended) the more recent one; here also you can see what minSdk (NOT the compiler version nor the targetSdk) is generated, which is not at all the same but probably something like 17. This value is created by P5 && i dont think that you can modify it from the Manifest; you can only import your code into AS and then modify the build.gradle.

  • So, i´ve exported the app to android studio.

    i´ve put minSdkVersion to 9 as > @corentin suggested.

    This is my build.graddle file :

    apply plugin: 'com.android.application'
    
    android {
        compileSdkVersion 26
        defaultConfig {
            applicationId "processing.test.nomofobia_app"
            minSdkVersion 9
            targetSdkVersion 26
            versionCode 1
            versionName "1.0"
            vectorDrawables.useSupportLibrary = true
            testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        }
        compileOptions {
            sourceCompatibility JavaVersion.VERSION_1_8
            targetCompatibility JavaVersion.VERSION_1_8
        }      
        buildTypes {
            debug {
                debuggable true
            }
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            }
        }
        lintOptions {
            abortOnError false
        }     
    }
    
    dependencies {
        implementation fileTree(include: ['*.jar'], dir: 'libs')
        implementation 'com.android.support:appcompat-v7:25.3.1'
        implementation 'com.android.support:design:25.3.1'
        implementation 'com.google.android.support:wearable:2.0.5'
        implementation files('libs/processing-core.jar')    
        testImplementation 'junit:junit:4.12'
        androidTestImplementation 'com.android.support.test:runner:1.0.1'
        androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'    
    }
    

    And also change minSdkAndroid my androidManifest to :

    <?xml version="1.0" encoding="UTF-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="processing.test.nomofobia_app">
        <uses-sdk android:minSdkVersion="9" android:targetSdkVersion="26"/>
        <application android:icon="@drawable/icon" android:label="nomofobia_app">
            <activity android:name=".MainActivity" android:theme="@style/Theme.AppCompat.Light.NoActionBar.FullScreen">
                <intent-filter>
                    <action android:name="android.intent.action.MAIN"/>
                    <category android:name="android.intent.category.LAUNCHER"/>
                </intent-filter>
            </activity>
        </application>
        <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
        <uses-permission android:name="android.permission.BIND_VPN_SERVICE"/>
        <uses-permission android:name="android.permission.CAMERA"/>
        <uses-permission android:name="android.permission.INTERNET"/>
        <uses-permission android:name="android.permission.VIBRATE"/>
    </manifest>
    

    Now getting this error :

    Manifest merger failed : uses-sdk:minSdkVersion 9 cannot be smaller than version 14 declared in library [com.android.support:support-v4:26.0.0] C:\Users\Julian Puppo\.gradle\caches\transforms-1\files-1.1\support-v4-26.0.0.aar\6a1967f1d0c20444cc8d39f4713ea08e\AndroidManifest.xml as the library might be using APIs not available in 9
        Suggestion: use a compatible library with a minSdk of at most 9,
            or increase this project's minSdk version to at least 14,
            or use tools:overrideLibrary="android.support.v4" to force usage (may lead to runtime failures)
    

    It seems as the library does not support previus versions? Wich library? What is that i have to change?

  • edited May 2018

    @Aurelian24===

    reading the error code it seems that minSdk is hardcoded by P5 to 14 in support-v4; in order to verify try to change 9 to 14 in your manifest && in the build.gradle; as the error message says you can also try to override the library: in this case go to your manifest and add:

    <uses-sdk tools:overrideLibrary="android.support.v4"/> (instead of the uses-sdk tag)

    leave gradle as it is.

Sign In or Register to comment.