App Inventor building extension fails to import android class

Hi,

I am a complete noob to App Inventor but I have managed to create and build a new extension using Java. However, as soon as I try to import an android library the build just fails as it cannot find the android class symbol.

…\appinventor-sources\appinventor\components\src\com\google\appinventor\components\runtime\MyExt.java:53: error: cannot find symbol
[javac] import android.provider;
[javac] ^
[javac] symbol: class provider
[javac] location: package android

I have just installed the latest (16 April 2020) Java (8u251), Java SDK (8u251), ANT (1.10.7), Cloned the App Inventor Sources, Git. Note: I do not have internet access on this machine and do not have Android Studio installed.

The “ant extensions” command work and build an extension if I do not require to import android libraries.

Having looked in the App Inventor sub-directories …\appinventor-sources\appinventor\lib\android\package-list file appears to list the android class I am trying to import. Also the tools sub-directory appears to show the android SDK is present here so I assumed I do not need to download this from elsewhere?

JAVA_HOME and ANT_HOME environment variables are present.

How does the build process try to locate/import libraries, and specifically the android ones?

I am obviously missing something very obvious here. Can anyone help?

Thanks,
Carl

Try
import android.provider.*;

OK that is great thanks, I am understanding a bit more now.

If the last part starts with an uppercase then it is the actual class name, otherwise it is a group/directory of classes so use an asterisk to import all of them.

1 Like