Contribute a Ionic 3 App to F-Droid - android

I'd like to contribute to the F-Droid GitLab Repo.
I followed this guide: https://gitlab.com/fdroid/fdroiddata/blob/master/CONTRIBUTING.md
I have done this already, many times with a normal native app. That worked great. But with an Ionic app it seems to be different. I see, for example, no gradle data in my Ionic app. Do I need gradle? Because the build failed because he can not run gradle clean ..
Heres my stack:
==== detail begin ==== FAILURE: Build failed with an exception.
What went wrong: Task 'clean' not found in root project.
This is how my metadata file looks like:
Categories:System
License:GPL-3.0
[...]
Repo Type:git
Repo:<Repo Link>
Build:1.0,1
commit=<commit>
gradle=yes
Auto Update Mode:None
Update Check Mode:None
Everything in <> is filled out correctly.

You are forging new ground here! We (F-Droid) don't have solid support for Cordoba/Ionic/etc. but the only thing preventing it is someone doing the work! We're working on adding a new build field sudo= which will let you download and install whatever you need to run your build. I've never used Ionic, Cordoba, or any of these Javascript app things, so I don't know the details.
You can follow the progress of sudo= here:
https://gitlab.com/fdroid/fdroidserver/merge_requests/297
It'll still be a while yet before this is deployed on our infrastructure, but your testing it will speed up that process!

Related

weird gradle warnings during react-native variant-release build

(using android,
openjdk-11.0.13_8
node v16.13.2
react-native 0.67.0)
i created a barebone react-native project with
npx react-native init testapp
then signed it according to official react-native documentation
then tried to create the release-variant with npx react-native run-android --variant=release
now i get BUILD SUCCESSFUL message and got apk, and it installs and works in my physical device...
BUT, i got a lot of gradle problem-warning ...here is one sample..
Task :app:processReleaseManifestForPackage Execution optimizations have been disabled for task ':app:processReleaseManifestForPackage' to
ensure correctness due to the following reasons:
Gradle detected a problem with the following location: 'D:\testapp\android\app\build\intermediates\merged_manifests\release'.
Reason: Task ':app:processReleaseManifestForPackage' uses this output
of task ':app:copyReleaseBundledJs' without declaring an explicit or
implicit dependency. This can lead to incorrect results being
produced, depending on what order the tasks are executed. Please refer
to
https://docs.gradle.org/7.2/userguide/validation_problems.html#implicit_dependency
for more details about this problem.
this same problem-warning is repeated for many other tasks!!...
NB i havent added any packages or changed any source code.. its the barebone app coming with react-native!... so how do i solve this issue?.. how to fix my settings so that this warning can be removed...
(i copied one of these tasks-names and did a text-search inside all files in my project directory to find out where its mentioned...but shockingly, its not mentioned anywhere!!!...so where are all these problem-warnings coming from? and how can we get a neat gradle build?)
this same warning is repeated in lots of lines in gradle output for other tasks too, such as:
Task :app:compressReleaseAssets
Task :app:processReleaseManifestForPackage
etc.. etc..

Adding snapchat SDK to android project causes instrumentation tests to fail with "No tests found"

I have been tasked with adding Snapchat login to our Android app. Great, I've got it integrated and the login works (after some faffing about configuring it).
However, after I opened my PR, our CI flagged that the connectedAndroidTest task was failing with the following message:
com.android.build.gradle.internal.testing.ConnectedDevice > No tests found.[Pixel_XL_API_26(AVD) - 8.0.0] FAILED
No tests found. This usually means that your test classes are not in the form that your test runner expects (e.g. don't inherit from TestCase or lack #Test annotations).
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':<app_name>:connectedDebugAndroidTest'.
> There were failing tests. See the report at: file:///C:/Users/<my_username>/StudioProjects/<project_name>/<module_name>/build/reports/androidTests/connected/index.html
I opened the report file, and it also stated that there were no tests found.
I have not touched, updated, opened or even dreamt about any test files whilst implementing this feature, and have certainly not changed anything about testing in our code base.
To prove this, I checked out dev, and ran the connectedAndroidTest command from there, they all passed. Then, I simply added the following snapchat dependencies to the gradle file on dev:
implementation 'com.snapchat.kit.sdk:login:1.6.5'
implementation 'com.snapchat.kit.sdk:core:1.6.5'
Synced the project with gradle, and then ran the connectedAndroidTest command again. This time, the tests fail with the "No tests found" error. So, no code change from me, just simply adding the snapchat dependencies is causing this issue.
What. On. Earth.
Really? Ok, so I've been pulling my hair out, scouring google for any advice and I've so far found nothing. So, I turn to StackOverflow; has anyone ever come accross such an issue? Any advice on how to start debugging and fixing this madness?
EDIT:
I have created a brand new, completely empty project, and can replicate this easily by just adding the snapchat dependencies.
Apparently when an apk is built for the instrumentation tests, it's missing some meta tags that are needed by the snapkit SDK
Adding an AndroidManifest.xml under the androidTest directory with only the following contents (even a not real client-id) resolves the issue.
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="your.app.package">
<application>
<meta-data android:name="com.snapchat.kit.sdk.clientId" android:value="dummy-snapchat-client-id" />
</application>
</manifest>
If you need to write tests that will use the snapchat SDK maybe you will need to provide your real client-id and any other meta-tags your normal AndroidManifest has

Gradle cannot handle generated code changes

My setup:
Android Gradle Plugin 3.5.0
Gradle to 5.5.1
100+ Gradle modules
lot of generated code (mostly Dagger + data binding)
When I checkout a branch which causes changes in generated code then usually I have to wipe out whole .gradle/caches directory to make the build succeed. Otherwise gradle build system tries to resolve some old generated code.
clean and cleanBuildCache don't help. Also a side note: so far I've been a happy user but since we updated tools to these versions then build caching stopped working properly. Any tips?
EDIT: Please note that not every change in generated code breaks the cache. It's nondeterministic for me so far.
Disclaimer: I'm a java developer and am not familiar with the Android plugin
The clean task won't remove entries from the build cache. The cache key is derived from the task inputs and outputs. If you haven't declared all of the task inputs correctly then the cache key won't be correct
If (for example) your "generate" task needs a template, some xml and a system property to generate the sources you will need to declare all three (template, xml and syspop) as task inputs to the "generate" task. Any output directory(s) will obviously need to be declared as a task output.
The last thing to consider is that the "generate" task is correctly wired into Gradle's DAG. Eg the "compileJava" task should "dependsOn" your "generate" task (or whatever the android equivalent task is)

gradle-play-publisher: Task 'bootstrap' or 'publishApk' not working

I am trying to integrate the gradle plugin https://github.com/Triple-T/gradle-play-publisher in version 2.0.0-beta1 to automatically upload a new version of an APK to the PlayStore.
I followed the instructions and created a service account and linked it to my PlayStore account.
Then I added my key document (JSON) in the app/build.gradle.
If I call ./gradlew tasks in my Android project, I now also see the task 'bootstrap', publishApk,... but when I call e.g. bootstrap or publishApk nothing happens.
No Taks does anythink right now :(
When I call ./gradlew -i bootstrap it says:
Task :app:bootstrap UP-TO-DATE Skipping task ':app:bootstrap' as it
has no actions.
Does anyone have any idea where my mistake is?
FYI:
I'm trying to do this in Android Studio 3.2.
Oh damn....
after reading the bug https://github.com/Triple-T/gradle-play-publisher/issues/81 and the corresponding answers until the end i noticed that my release-build has set the property debuggable true at the moment (due to tests). After removing this the plugin works as expected.
Sorry for the confusion ;)

PlayN - can't compile android version

Following this, I tried to run the showcase app on my phone (the html and java versions both work fine). I get this error when I try to run mvn -Pandroid install though:
Failed to execute goal com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.6.0:generate-sources (default-generate-sources) on project playn-showcase-android: Execution default-generate-sources of goal com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.6.0:generate-sources failed: A required class was missing while executing com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.6.0:generate-sources: Lorg/sonatype/aether/RepositorySystem;
Apparently this has something to do with some plugin being outdated/not working with maven 3.2 (which I'm running). I'm just not sure what I'm to do with that information. Maven is still relatively confusing for me (this doesn't seem to do anything too complicated, still it's a lot of boilerplate to digest), and I'm not sure what I can do to fix that problem there.
So, as it turns out hardcoding the version to 3.9.0-rc.1 kinda fixed it. I'd still like to know where the maven.android.version property comes from so I can do this properly.

Categories

Resources