Extension Template Repository

1.I can send you.
2.Some extension developers still use old version in their repos.

1 Like

Yes, I get a similar issue after trying to build a fresh template:

The "my-extension" dir is created, but there are no libs (or I cannot find them).

Yes, but where are the libs?

Maybe this link will help (unfortunately I'm not familiar with git):

ssh -vT git@github.com

Thanks! :smiley:

That solution will only work on Mac and Linux and not on Windows.
Also, it is just because of an unknown host.

But what for windows?

I've updated the gitmodule configuration to use HTTPS for the dependency repo rather than SSH. If you've already checked it out, you can do:

git submodule deinit .
git pull
git submodule update --init

You should get a message back like:

Submodule 'lib/appinventor' (https://github.com/mit-cml/extension-deps.git) registered for path 'lib/appinventor'
Submodule path 'lib/appinventor': checked out '477586b7e1901db30ed6b8e76cf524c4a05b2802'

If you had trouble with the submodule update operation, you may also see it download the commits from the server.

3 Likes

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).