Specific Icon Generator for Processing Android Project

Sharing some work that lets you create required icons from an image source specifically to include in Processing Android Project to create signed and aligned packages to distribute on Google Play Console.

More about generating signed and aligned packages with Android Mode is mentioned here -

https://android.processing.org/tutorials/distributing/index.html

2 Likes

@Rupesh_Kumar Thank you so much for the android icon generator. It does indeed create an android icon suite as advertised. However, I am still unable to export a signed package in spite of giving my app a name in the manifest (eg, com.xxxx.yyyy) and adding the icons. Nonetheless I did get further into the process than before: I was asked to setup a keystore password which I did do. However, multiple attempts failed with the following error message. This is on MacOS 11.0.1 (Big Sur). I doubt that any of this is the fault of your project which was sorely needed in my opinion. Thanks once again.

@svan I am currently using windows, So I would not be able to identify. But I would suggest you do some of the following things to identify the issue:

In PDE first select “File” => “Export Android Project”. (To export the project).
Then in the terminal navigate to the project folder (In windows it is Documents/Processing/sketch folder/android/)
run command gradle -stacktrace assembleRelease to check the cause of the issue in detail.
You can share the lint task issue details for discussing it further.
You can also check file that will be generated after the command at
sketch folder/android/build/reports/lint-results-yourBuildName-fatal.html
The error occurs usually in the resource files, an id is used as a parameter but it’s not defined anywhere. for example, mentioned here

Also, to build package from the project exported from PDE you can try adding the below code in build.gradle file -

android {
    ...
    lintOptions {
        checkReleaseBuilds false
    }
}

I hope it would help.
Thanks,
Rupesh

@Rupesh_Kumar Thank you for your efforts to help me export a signed android package on my Mac. Unfortunately my Terminal does not recognize the ‘gradle’ command so I could not generate a stack trace. I did import the project that Processing created into Android Studio and was able to run it without error. I found the lint-results …html file and it showed no errors. I also tried to edit the build.gradle file by opening it into Android Studio and set the checkReleaseBuilds to false but I still get the same error. The macOS is 64 bit and I don’t know if that’s the problem or if it’s a Processing IDE (3.5.4) problem. I am relatively new to creating Android apps and have much to learn. At this point it seems like a very complicated process. The icon suite created by your project showed up in Android Studio as expected.

@svan
To install gradle to your mac system you can follow this or this

As far as I know, PDE will never use the exported projects to build signed packages as it will use its default configuration of build and source files. Whenever a task is performed say generate signed package So files changing exported project will not work if you would try to generate signed package on PDE. Whenever a task is performed for building a signed package, a folder gets created for example in windows C:\Users\Name\AppData\Local\Temp\android148..4324304026sketch
This folder is used to create a signed package and it gets deleted as soon as the task gets completed. So it will never use the exported project to build the app. Changed build.gradle file from the exported project will not work as it will use build.gradle file from a temporary project which gets created every time a task is performed in the PDE.

I tried reproducing the issue and found that you are getting the following error-
Caused by: org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:lintVitalRelease'. at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.lambda$executeIfValid$3(ExecuteActionsTaskExecuter.java:186) at org.gradle.internal.Try$Failure.ifSuccessfulOrElse(Try.java:268

In the same error if you see the following line it means that you can easily fix it -
Caused by: com.android.builder.errors.EvalIssueException: Failed to parse XML in C:\Users\Name\AppData\Local\Temp\android805....05570sketch\app\src\main\AndroidManifest.xml The minSdk version should not be declared in the android manifest file. You can move the version from the manifest to the defaultConfig in the build.gradle file. at com.android.builder.errors.IssueReporter.reportError(IssueReporter.kt:106)

To fix this you need to remove the following line in Documents\Processing\sketch_210910a\AndroidManifest.xml(The same file in which you have included the new package id)
<uses-sdk android:minSdkVersion="17" android:targetSdkVersion="29"/> - this line needs to be removed in SketchSavedFolder../AndroidManifest.xml.

I hope it will resolve.

Thanks,
Rupesh

1 Like

@Rupesh_Kumar
Thank you so much for continuing to work on this. You are exactly right about removing the ‘uses’ line in AndroidManifest. I no longer see the error message and the export process finishes after I enter my password. There are now three new folders in the sketch folder along with the icons created by your utility (see below). However I’m not certain what has been created. I was expecting to see an android app with its icon in the ‘build’ folder, but all that I see is three .apk files and one metadata file. This is the first time that I have been able to do this on a Mac and it may take me a while to figure out what has been done. At any rate, I greatly appreciate your efforts in allowing me to get this far.

@svan Good to know that you have resolved it, you can move this APK file on Android Device via Data cable or Bluetooth transfer and there you can install the app by clicking the APK file. You may get a prompt to check unknown resource installation if you are installing the app for the first time. This depends on the Android Device but checking unknown resources installation will enable your device to install APK on your device. You can find more device-specific APK installation information online. All three APK files are installable on the device and work the same. You will not be able to distribute Unsigned APK on Google Play Console, Aligned-Signed APK is the best one and is distributable.
I would recommend the official Processing for Android website to continue learning more about it.

Happy Learning,
Rupesh

1 Like

It worked!!! I used the app Android File Transfer to show the Android device folder system and then drag 'n dropped the signed_aligned.apk file to the Android folder on the tablet SD card. When I went to the Apps folder sitting there was your red icon which opened my app when I double clicked it.

I previously had read the error message and deleted the minSDK version as instructed but left the targetSdkVersion in place. What I did not do was delete the entire ‘uses’ line and that made all the difference.

In summary, (for the next Mac user who encounters this problem) in order to export an Android app on a Mac you need to do four things:
a) Insert a package name between the pre-existing quotation marks in the AndroidManifest.xml file, eg com.xxxx.appName
b) Delete the ‘uses’ line in the AndroidManifest.xml file thereby removing minSdkVersion and targetSdkVersion.
c) Provide an icon suite: see initial post in this thread. Copy the icon suite to the sketches folder.
d) Copy one of the three .apk files (preferably signed_aligned) to your Android device (Android folder).

Thanks again for your persistence and help.