Extension Template Repository

It seems that I was successful:

Thanks for updating.

I used this only to update and it works perfectly :+1:

1 Like

Thanks all for the feedback. As we continue to build out the extension system please let me know when you encounter any other issues.

1 Like

Sir getting error for me when I command ant extension its build successfully and when I commnd for proguard its giving error

No problem in older extension template

[proguard] Reading library jar [C:\Users\varsha\Desktop\new xxxxx template\extension-template\lib\appinventor\apksigner.jar] (filtered)

BUILD FAILED
C:\Users\varsha\Desktop\new xxxxx template\extension-template\build.xml:86: The following error occurred while executing this line:
C:\Users\varsha\Desktop\new xxxxx template\extension-template\build.xml:101: The following error occurred while executing this line:
C:\Users\varsha\Desktop\new xxxxx template\extension-template\build.xml:178: Can't read [C:\Users\varsha\Desktop\new xxxxx template\extension-template\lib\appinventor\apksigner.jar] (only DEFLATED entries can have EXT descriptor)

Total time: 10 seconds
Picked up _JAVA_OPTIONS: -Xmx1024M

None of the above mentioned steps worked for me unfortunately.
Then I did this:

  • Downloaded ZIP file
  • manually added libs to /lib/appinventor dir

Edit1: But I am getting this error now

[javac] error: Bad service configuration file, or exception thrown while constructing Processor object: javax.annotation.processing.Processor: Provider org.datanucleus.enhancer.EnhancerProcessor could not be instantiated: org.datanucleus.exceptions.NucleusException: Plugin (Bundle) "org.datanucleus" is already registered. Ensure you dont have multiple JAR versions of the same plugin in the classpath. The URL "file:/D:/ex/lib/appinventor/datanucleus-core-1.1.5.jar" is already registered, and you are trying to register an identical plugin located at URL "file:/D:/ex/lib/appinventor/datanucleus-core-3.1.3.jar."

Edit2: Probably error is here

image

Edit3: I deleted 1.1.5 jar and got this error:

[javac] error: Bad service configuration file, or exception thrown while constructing Processor object: javax.annotation.processing.Processor: Provider org.datanucleus.enhancer.EnhancerProcessor could not be instantiated: java.lang.NoClassDefFoundError: org/datanucleus/OMFContext

Delete the whole folder and try this:

go to your desire directory and use git bash to execute

git clone https://github.com/mit-cml/extension-template.git

After cloning, cd into the folder you have just cloned and just execute

Actually my internet is super slow and I have less time so I just compiled the extension with older version. :sweat_smile:

1 Like

There is no reason you should be dealing with datanucleus libs when doing extension dev

The template doesn't have any of the datanucleus libraries. You may want to look at how you've set up your extension and determine whether those libraries are really needed.

Sorry, it is my mistake.
A well known copy-paste issue.

1 Like

I just clone new template and trying to cmd proguard but getting same error
Extension build successfully but not working on proguard cmd

[proguard] carry the GNU General Public License as well. Alternatively, you can
[proguard] apply for an exception with the author of ProGuard.
[proguard] Reading input...
[proguard] Reading program jar [C:\extension-template\build\externalComponents-classes\com.varsha.revealeffect.jar] (filtered)
[proguard] Reading library jar [C:\extension-template\lib\ant-contrib\ant-contrib-1.0b3.jar] (filtered)
[proguard] Reading library jar [C:\extension-template\lib\appinventor\AndroidRuntime.jar] (filtered)
[proguard] Reading library jar [C:\extension-template\lib\appinventor\AnnotationProcessors.jar] (filtered)
[proguard] Reading library jar [C:\extension-template\lib\appinventor\Barcode.jar] (filtered)
[proguard] Reading library jar [C:\extension-template\lib\appinventor\CommonVersion.jar] (filtered)
[proguard] Reading library jar [C:\extension-template\lib\appinventor\QRGenerator.jar] (filtered)
[proguard] Reading library jar [C:\extension-template\lib\appinventor\acra-4.4.0.jar] (filtered)
[proguard] Reading library jar [C:\extension-template\lib\appinventor\android.jar] (filtered)
[proguard] Reading library jar [C:\extension-template\lib\appinventor\androidsvg.jar] (filtered)
[proguard] Reading library jar [C:\extension-template\lib\appinventor\annotation.jar] (filtered)
[proguard] Reading library jar [C:\extension-template\lib\appinventor\apksigner.jar] (filtered)

BUILD FAILED
C:\extension-template\build.xml:86: The following error occurred while executing this line:
C:\extension-template\build.xml:101: The following error occurred while executing this line:
C:\extension-template\build.xml:178: Can't read [C:\extension-template\lib\appinventor\apksigner.jar] (only DEFLATED entries can have EXT descriptor)

Total time: 4 seconds
Picked up _JAVA_OPTIONS: -Xmx1024M

varsha@varsha-PC MINGW64 /c/extension-template (master)

I have built an extension and tried to download a file to the ASD (app-specific dir). This works fine on devices with API < 29.
But on devices with API > 28 I get this error:

grafik
I get the same error with the full path.

Here is my code:

Java

@SimpleFunction(description = "Downloads APK to AppSpecificDir (ASD): /storage/emulated/0/Android/data//files/. Note: No WRITE permission required.")
public void DownloadApkToASD(String url,String fileName){

	String name = fileName;
DownloadManager.Request request = new DownloadManager.Request(Uri.parse(url));
request.setMimeType(URLConnection.getFileNameMap().getContentTypeFor(url));
request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
	
	int version_api = Build.VERSION.SDK_INT;
	if (version_api > 28){
	request.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS,name); //downloads to /storage/emulated/0/Download, not to the ASD (as it should)
	}
	else {
	request.setDestinationInExternalPublicDir(context.getExternalFilesDir(null).toString().replace("/storage/emulated/0",""), name);  // doesn't work for API > 28	
	}

DownloadManager dm = (DownloadManager) context.getSystemService(Context.DOWNLOAD_SERVICE);
dm.enqueue(request);

}

Does anyone have any idea how to solve this?
I compiled it with the old Extension Template (without AndroidX):
import android.support.v4.content.FileProvider;

Can you please verify that API levels you have mentioned are correct? Because I am confused.

Sorry, but I don't understand.
I only used this in my code:

if (version_api > 28) {
...

Is something wrong with it?

request.setDestinationInExternalPublicDir(context.getExternalFilesDir(null).toString().replace("/storage/emulated/0",""), name);

works fine for devices with Android 9 and below (API < 29), but NOT on Android 10 and above (API > 28).

6 posts were split to a new topic: Problems building extension from appinventor-sources

today i tried to build aix with extension-template and
when i run ant extensions the result is BUILD SUCCESSFUL but when i try to run
ant extensions -Dproguard=1 it show me the BUILD FAILED result.

how do i solve this problem?

I'm going to need more information about how it failed. Do you have a stack trace or other error message?

No, or maybe i dont understand :confused:

Probably it needs some changes:

1 Like

@vknow360, @ewpatton

And i want to ask i am using git, and when i want to build aix in extension-template i left click in extension-template folder and build using gitbash (I build my aix outside the src folder).

Salman@DESKTOP-BK3S90V MINGW64 ~/extension-template (master)

is what i did right?

And if I want to upgrade my extension-template with the latest one
do I just need to run upgrade-appinventor.sh?