Testing the next release of MIT App Inventor (nb187)

Ok, thanks:


HelloPurrAssets2.aia (186.8 KB)

But with the APK I get these assets (again: images, webkit):

although these are not present in the assets:

I have tried to put this directory in different places.

With APK on Android 11:

This is normal, unless you manually remove them in code.

Why and why does this only happen with the APK?
And why doesn't that happen with the TaifunFile extension?

And to what extent should that be "normal"?

I think the answer is in the link you provided.

My guess is that system relies on this assets to be present in all .apk files. But instead of building them in (which would increase size of all .apk files), Android emulates them via asset API.

I think @Taifun can tell you if its extension makes these system folders invisible.

If these folders are physically in assets, I also think the file component is behaving correctly. Whether we want these folders to be visible or not is another question.

FileTools will also show same behaviour.
Extension removes those items from Asset List.

String[] dir = {"webkit","external_comps","images"};

                for(String r:dir){
                    fileNames.remove(r);
                }

Those folders are necessary, don't know why, but you can find them there always.

1 Like

my file extension removes these default directories webkit and images from the list
and it also removes the directory external_comps which appears after using extensions...
to not confuse people, let me suggest to remove these directories also in the new method ListDirectory of the file component for FileScope Asset...

Taifun

2 Likes

Yes, but that will happen anyway (even without this problem), I would make any bet. :wink:

I added a helper class as a jar, unfortunately the same effect. The helper block does not return a value, it shows an error:
error

The class adds correctly to the extension because the drop-down list is valid as declared in the class.

@Patryk_F I've just submitted this patch for review. I was able to create a simple extension and load it into the companion with helper blocks:

And for the test:

image

For this test, the directory hierarchy looked like:

- components
  - src
    - edu
      - mit
        - appinventor
          - extension
            - helpertest
              - helpers
                - FoodOption.java
              - Animal.java

@Anke I'm taking up your example app now. But to answer some of your other questions:

In the companion, the assets are stored on disk (recall that assets are typically in the APK and read-only), and extensions are stored as assets under the external_comps directory. You don't see this in the compiled APK because the extension becomes part of the app during the build.

In the compiled APK, the assets come from the AssetManager class, which includes not only the app's assets but the system framework assets as well. In theory, you can override these by providing your own at the corresponding paths. Also, different Android distributions could include additional assets as part of the base framework assets, so it isn't sufficient to hard code which paths to exclude. Rather than guess I figured it would be alright to include them in the list. It seems I should rethink that (and think about how to address the open-endedness of the problem). You will note that in my test app I use the IsDirectory block to filter out these directories.

2 Likes

Hi all,

http://ai2-test.appinventor.mit.edu is updated to include the following changes:

  • Fix an issue where the Marker Width/Height properties would not apply to raster image assets
  • Fix an issue where APKs created from AABs would compress media assets (e.g., mp3, mov), which would prevent them from loading in Media components (e.g., Player, Sound)
  • Fix an issue where the app name may be dropped from the project properties file
  • Fix an issue where shared files would be written to the wrong MediaStore table
4 Likes

I have modified the ExternalComponentGenerator.java file in my sources according to your changes, unfortunately I still cannot get the value. Anything else that needs to be changed besides this file? In the extension structure, I can see that the helpers class has been added to the extension.

Tried and it's working.

1 Like

You might be getting a cached version of the dex file. For testing purposes, try removing the extension from your test project and adding it back. Here's the test project I created for testing. Does it work for you?

HelperExtensionTest.aia (7.4 KB)

Yes, it helped. Thanks. I was already pulling my hair out and the solution was so simple :grin:

1 Like

Normal server

Testserver

See the size of the imagepicker and button.

Even in the designer you can see the difference.
Normal server


Testserver

Furthermore i wonder if the permission system is still working.
On de normal server the permission to use WRITE_EXTERNAL_STORAGE is asked but not on the testserver. There it just displayes the notifier after starting the app.

I saw this morning that the new helper blocks had changed my textbox into a helper block
image

But changing back to textbox didn't help.

Could someone also please test and see if the permissionssystem still works.

Edit @vknow360 showed me why i was wrong :grin:

1 Like

Probably you are testing in Android 11 where that permission doesn't exist.

2 Likes

I really dislike Android 11 :crazy_face:

If i don't use the camera permission but just
image

The camera permission is asked but when i give permission i get the Error 908 message that WRITE_EXTERNAL_STORAGE is denied.

This happens also with the image picker.

2 Likes

If → DefaultFileScope is not set to → Legacy in the Designer

this also happens on Android versions between 4.4 and 9
(Android ≥ 4.4 [KitKat, API 19] and ≤ 9 [Pie, API 28]),
because the maxSdkVersion for READ / WRITE is 18.

<uses-permission android:maxSdkVersion="18" android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:maxSdkVersion="18" android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

See also here:

EDIT: If you set → DefaultFileScope to → Legacy in the Designer:

grafik

READ / WRITE permission are declared this way:

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

and it seems to work (also on Android 11).

2 Likes