[SOLVED] Meteor 2.5.0 - add-platform android

With 2.5.0 meteor version, after do command “meteor add-platform android” I have a problem:

Creating a new cordova project. -
Using cordova-fetch for cordova-android@10.1.1
Adding android project… /
Creating Cordova project for the Android platform:
Path: platforms/android
Package: com.sample.name
Name: name
Activity: MainActivity
Android target: android-30
Subproject Path: CordovaLib
Subproject Path: app
Android project created with cordova-android@10.1.1
android: added platform

Your system does not yet seem to fulfill all requirements to build apps for Android.

Please follow the installation instructions in the mobile guide:
Cordova | Meteor Guide

Status of the individual requirements:
✓ Java JDK
✓ Android SDK
✗ Android target: Command failed with ENOENT: avdmanager list target
spawn avdmanager ENOENT
✓ Gradle

Obviously I have sdk platform 30 and sdk build 30 installed, but I can understand what is the problem.
With Meteor 2.4.0 all is good.

It seems you don’t have ‘avdmanager’ in your PATH. Make sure $ANDROID_HOME/tools/bin/ is in your path env var.

1 Like

Great ! This solve the problem !
But now I have another problem, when I try to build android app with “meteor build …/name-build --server=https://name.sample.com --packageType=apk --verbose” I get:

  • What went wrong:
    A problem occurred evaluating script.

No installed build tools found. Install the Android build tools version 30.0.3 or higher.

I have already installed build tools, 30.0.3 and 31.0.0.

After investigation, I found a problem, is a variable name “ANDROID_HOME” now it must be “ANDROID_SDK_ROOT”.

Another problem now…
I can’t build android app yet, I get error:

Task :app:compileReleaseJavaWithJavac FAILED
/home/me/Sviluppo/meteor/name/.meteor/local/cordova-build/platforms/android/app/src/main/java/cordova/plugins/Diagnostic.java:57: error: cannot find symbol
import android.support.v4.app.ActivityCompat;
symbol: class ActivityCompat
location: package android.support.v4.app
/home/me/Sviluppo/meteor/name/.meteor/local/cordova-build/platforms/android/app/src/main/java/cordova/plugins/Diagnostic_External_Storage.java:28: error: cannot find symbol
import android.support.v4.os.EnvironmentCompat;

Which are the right version of the java dev kit ? I’m using openjdk 1.8.

@davideonmeteor it seems you are depending on libs using support.v4.
As stated in our changelog here Meteor Changelog | Meteor API Docs

  • Cordova Android v10 now enables AndroidX. If you use any cordova-plugin that depends or uses any old support library, you need to include the cordova-plugin-androidx-adapter cordova-plugin, otherwise you will get build errors.

Can you please try adding this plugin? And you are right, you should use openjdk 1.8. I have more info on that in my video about setting the complete environment: How to Develop with Android on Meteor - YouTube

I tried adding this plugin with “meteor add cordova:cordova-plugin-androidx-adapter@1.0.0” but this not solved the problem.

The Problem seems to be that now android is using a new tool to build.
You need to install this:

and then add the path to your .bash_profile
export PATH=$PATH:$ANDROID_HOME/cmdline-tools/latest/bin

Not 100% sure, but this fixed it for me.

Thanx for advice but I had already do it, without lucky…

@davideonmeteor can you try upgrading your cordova.plugins.diagnostic to a version that is higher than 6 ?
On > 6 they started using androidx.

This plugin is at 6.1.0 version, last version.

Solve it adding version 31 of Android build tools.