PlayN - can't compile android version - android

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.

Related

Upgrading to Gradle 7.1.1 in Android Studio Breaks Build

After upgrading to Gradle 7.1.1, I get the following build error:
Unexpected EOF in prolog
at [row,col {unknown-source}]: [1,0]
I've done as many Google searches as I could but can't find anything on this. I've tried running the build with stacktrace, debug and scan options but there is nothing in the output window that gives a hint as to where this is coming from, except that it's in this task:
app:mergeProductionDebugResources FAILED
I'm assuming there is some file somewhere that's doing this but I don't know how to begin finding it.
I would like to know if there is some place to look that I'm not aware of, or if there is some procedure to help me track this down.
I found my issue. Someone had added an empty xml file to the project. Previous versions of gradle just ignored this, but 7.1.1 doesn't.

Android studio NDK Gradle build "Source ... and destination ... must be different"

I'm using Android Studio with NDK, Gradle and CMake to build several shared libraries and link them together.
I keep getting the same error again and again in the build log:
:app:processDebugManifest [Passed]
:app:externalNativeBuildDebug [Passed]
Source C:\XXX\app\build\intermediates\cmake\debug\obj\arm64-v8a\libBGS-d.so and destination C:\XXX\app\build\intermediates\cmake\debug\obj\arm64-v8a\libBGS-d.so must be different
It's like gradle is trying to copy my library at the same position.
The thing is, I have no idea where this instruction comes from and how I can debug it. There's really not much indication in the build log.
What's confusing is that is doesn't occur 100% of the time. Seems like there is a race condition somewhere. Also sometimes it's another library that triggers the build to fail. Also, cleaning the project doesn't help.
So here's my question: is there any place where I can get granular control over the Gradle build sequence ?
According to Dan Albert at https://stackoverflow.com/a/62223434/8068814 this appears to be a bug and he suggests cleaning the project, then triggering "refresh linked c++ projects" and then building the project. Since it is sometimes working for you, this might be a reliable solution in your case.
For me this did not help, but reverting the Gradle plugin to 3.6.2 was the only way for me to build my project.

Android - Deprecated NDK warnings in Android Studio

After a long time working fine my project suddenly build failed. The image below is what i get from log.
I already have gradle.properties file with 'android.useDeprecatedNdk=true' in my project but the error keep show up.
Please help. :(
The warning says that useDeprecatedNdk=true will stop working soon. If you plan to keep using the latest Gradle Plugin, you should edit your build.gradle and use externalNativeBuild.
Actually, the change should be pretty easy, and the explanation on developer.android.com is quite straightforward.
The error you see is probably not related to the warning. Something went wrong in your build. The easiest way to find out is to run same ndk-build in the terminal window of your Android Studio, and analyze the results.
Carefully copy all parameters from the log, and add V=1:
/Users/haulx94/Library/Android/sdk/ndk-bundle/ndk-build NDK_PROJECT_PATH=null APP_BUILD_SCRIPT=/Users/haulx94/AndroidProject/hd1-android/HDONE/app/build/intermediates/ndk/stagging/debug/Android.mk APP_PLATFORM=android-25 NDK_OUT=/Users/haulx94/AndroidProject/hd1-android/HDONE/app/build/intermediates/ndk/stagging/debug/obj NDK_LIBS_OUT=/Users/haulx94/AndroidProject/hd1-android/HDONE/app/build/intermediates/ndk/stagging/debug/lib APP_STL=gnustl_shared APP_ABI=armeabi-v7a V=1

Contribute a Ionic 3 App to F-Droid

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!

All sorts of errors running Robolectric tests: Theme.AppCompat, NoClassDefFoundError and more

My Android project has about ~70 Robolectric tests and they were all passing for 2 months. Somehow, starting today, the tests are failing with weird error messages:
java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
java.lang.NoClassDefFoundError: org/apache/http/client/HttpClient
Also can't load resource files
I didn't change my code, so it can't be code related issue. I cleaned project and gradle but it didn't help. I did do a update promoted by Android Studio a few days ago, not sure if related.
Is anyone else is experiencing the issue? How do I get out of this bad state?
-- edit --
Robolectric version matters! Interesting observation based on suggestions in comments, robolectric version v.s. failure rate:
3.3.1, ~40% of the tests fail.
3.2.2, ~40% failure (same as 3.3.1)
3.1.4, ~15% failure
3.1.2, ~0% failure (with caveats, see below)
3.1, 100% failure (!)
Another observation is that it's inconsistent. If I run the whole set, all pass! But If I only run one test file, all fail with this message:
No such manifest file:
build/intermediates/bundles/debug/AndroidManifest.xml
AS is quite sensitive about dependencies change, as well AS doesn't set the working directory for tests by default.
No such manifest ... error directly saying that Robolectric can not find your manifest.
Whenever you have test failing in AS check first the command line run if it is reproducible.
Check first working directory for test:
I would also recommend to setup module directory as working directory by default:

Categories

Resources