How do I edit the manifest in App Inventor (for playing video on the WebViewer)

1,307 views
Skip to first unread message

Yossi Yaron

unread,
Jan 23, 2018, 8:19:11 AM1/23/18
to MIT App Inventor Forum
Hi,
In this post https://groups.google.com/d/msg/mitappinventortest/B4UoOfh8EWA/ckEgrTbfAAAJ  Boban suggested we edit the manifest file in order to enable video on the WebViewer component.
How do I do that in App Inventor?
Thank you
Yossi Yaron

Chris Ward

unread,
Jan 23, 2018, 8:36:27 AM1/23/18
to MIT App Inventor Forum
Hello Yossi

The format of the manifest file (which is found inside the .apk file) is such that you need an editor which converts it to plain text to enable you to modify. Once the manifest has been modified, the .apk has to be re-assembled in a certain way. So, none of this can be described as anything other than "advanced", even though the modification is very simple. 

There is a set of Java tools, delivered with the Java JDK, that do the job. However, an easier solution has been defined as a single app called "AppToMarket", developed by Android expert Hossein Amerkashi. This app supports all sorts of changes and makes it easy to apply them, but at the moment it is not uptodate with the latest version of App Inventor and cannot be used.


Yossi Yaron

unread,
Jan 23, 2018, 10:27:11 AM1/23/18
to MIT App Inventor Forum
Hello Chris,
Thank you for the ultra-quick response and the detailed answer.
If I understand you correctly, the solution you are proposing is totally outside of App Invnetor: I have to hack into the APK file outside of App Inventor (using AppToMarket or Android Studio/Eclipse) . This would mean that I cannot debug the app using the AI Companion.
Is that correct?
Is there no other way?
To the MIT App Inventor development team - is there any plan to add that capability in the near future?
Either way - thank you Chris
Yossi

Juan Antonio

unread,
Jan 23, 2018, 10:29:19 AM1/23/18
to MIT App Inventor Forum
Here an tutorial:


but it's easier directly with apktool,

Download apktool...

C:\Windows>apktool d C:\Users\juan\Downloads\yourapp.apk

Get a folder yourapp

Modify AndroidManifest.xml

C:\Windows>apktool b C:\Windows\folder_yourapp -o your_app.apk


If you want upload to Google Store need resigned https://developer.android.com/studio/publish/app-signing.html




Chris Ward

unread,
Jan 23, 2018, 10:49:18 AM1/23/18
to mitappinv...@googlegroups.com
Hello Yossi

There is no other way other than to modify the .apk file outside of App Inventor. You can debug by installing the .apk on your device (device set to developer mode).

You could define your app in an App Inventor compatible IDE that is mostly based on the same underlying code as App Inventor. There are a few out there. It can't be guaranteed that they are all 100% compatible with each other and App Inventor so it is best to see your project through on just the one platform.

http://www.appybuilder.com   (related to AppToMarket)

Edit: You could launch YouTube from your app, in the device's default browser, via App Inventor's Activity Starter.


Yossi Yaron

unread,
Jan 24, 2018, 9:42:04 AM1/24/18
to MIT App Inventor Forum
Hi everyone,
Thank you for your help.
I tried editing the manifest file, both using ApkTool and AppToMarket). In both cases I get the following error message when I install: "Parse error
There was a problem parsing the package"
Here is an extract from the AndroidManifest.xml file after editing (the change is highlighted in red):

<?xml version="1.0" encoding="utf-8" standalone="no"?><manifest xmlns:android="http://schemas.android.com/apk/res/android" package="appinventor.ai_yossiy_edu.youtube_viewer" platformBuildVersionCode="22" platformBuildVersionName="5.1.1-1819727">
    <uses-sdk
        android:targetSdkVersion="14" />

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

What am I doing wrong?
I had the same problem both on my Xiaomi Redmi Note 4 phone and on a GenyMotion emulator emulating Samsung Galaxy S2.

Thank you
Yossi

Yossi Yaron

unread,
Jan 24, 2018, 9:45:13 AM1/24/18
to mitappinv...@googlegroups.com
Here are the apk files before and after modification and the full manifest file (after editing).


Posting of apk files in this forum is prohibited as a security issue.  You are welcome to post an aia file and/or block images.
AndroidManifest.xml

Yossi Yaron

unread,
Jan 24, 2018, 11:36:41 AM1/24/18
to MIT App Inventor Forum
I see that the APK files could not be uploaded here.
Here is the AIA just in case it would help.
Needless to say that the original APK works fine (but doesn't show the videos...)

youtube_viewer.aia

Chris Ward

unread,
Jan 24, 2018, 3:46:29 PM1/24/18
to MIT App Inventor Forum
Hi Yossi

See this post for the exact syntax to use and also the note about minSdkVersion:

Yossi Yaron

unread,
Jan 25, 2018, 4:52:24 AM1/25/18
to MIT App Inventor Forum
Hi again Chris
Thank you for your patience.
I tried every variation and nothing works...
Then I had an idea - I decompiled and re-compiled without making any changes to the Manifest file, and lo and behold - it still didn't work... This applies to both tools (ApkTool and AppToMarket).
Any idea what is going on?
I am using Windows 10 64 bit. 
Thank you 
Yossi Yaron

Chris Ward

unread,
Jan 25, 2018, 7:52:25 AM1/25/18
to MIT App Inventor Forum
Hi Yossi

If you go back to the AppToMarket link I posted, you will see that everything has to be right - including the version of Jar Tools used, which files should be in which folders etc. If you pick your way through that lot, as others have, you should be able to recompile successfully (zip aligned).

Boban Stojmenovic

unread,
Jan 25, 2018, 6:19:42 PM1/25/18
to mitappinv...@googlegroups.com
Hi Yossi,

This should also work for you as it did for me, so make sure that what is marked looks the same on your manifest..


<?xml version="1.0" encoding="utf-8" standalone="no"?>

<!-- ****
     **** Generated by AppToMaret on Thu Jan 25 12:54:03 CET 2018
     **** If you wish, you can update this file to your needs.
     **** If updating, it has to be done prior to clicking 'Create New .apk' button AppToMarket
     **** However, please make sure that your updates WILL NOT break the functionality.
     **** For example, removing permissions, could cause runtime exceptions
     ****
-->
android:versionCode="1"
android:installLocation="auto"
android:versionName="1.0" package="appinventor.ai_bobans_s73.youtube_viewer" platformBuildVersionCode="22" platformBuildVersionName="5.1.1-1819727">

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

   
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
   
<uses-permission android:name="android.permission.INTERNET"/>
   
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
   
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
   
<uses-sdk android:targetSdkVersion="14" android:minSdkVersion="7" />
<application android:debuggable="false" android:icon="@drawable/ya"  android:theme="@android:style/Theme"  android:label="youtube" android:name="com.google.appinventor.components.runtime.multidex.MultiDexApplication">
       
<activity android:screenOrientation="behind" android:configChanges="keyboard|keyboardHidden|orientation" android:name=".Screen1" android:windowSoftInputMode="stateHidden">
           
<intent-filter>
               
<action android:name="android.intent.action.MAIN"/>
               
<category android:name="android.intent.category.LAUNCHER"/>
           
</intent-filter>
       
</activity>
       
<activity android:screenOrientation="behind" android:configChanges="keyboard|keyboardHidden|orientation" android:name="appinventor.ai_bobans_s73.youtube_viewer.Screen2" android:windowSoftInputMode="stateHidden">
           
<intent-filter>
               
<action android:name="android.intent.action.MAIN"/>
           
</intent-filter>
       
</activity>
   
</application>
</manifest>


Btw, this is for the project you posted here earlier.

/Boban

Reply all
Reply to author
Forward
0 new messages