Leso_KN
Leso_KN

Reputation: 176

Android aapt crash when including any kind of resources

I'm having some troubles packing resources into an apk using aapt. Everything works fine when having no @drawable/[...] or @styles/[...] directions in my AndroidManifest.xml. But as soon as i add for example android:icon="@drawable/icon" aapt crashes *after parsing my icon file (so compressing the image and stuff seems to work).

The command i'm using is:

aapt package -v -f -M AndroidManifest.xml -S res -I android.jar -F test.apk

It fails when using -S res and adding @-directions in the manifest. Otherwise it succeeds.

Output log:

[...]
applyFileOverlay for menu
applyFileOverlay for mipmap
Processing image: res/drawable/icon.png
Processing image: res/drawable-ldpi/icon.png
Processing image: res/drawable-xhdpi/icon.png
    (processed image res/drawable-ldpi/icon.png: 82% size of source)
    (processed image res/drawable-xhdpi/icon.png: 95% size of source)
    (processed image res/drawable/icon.png: 60% size of source)
    (new resource id icon from drawable/icon.png #generated)
    (new resource id icon from ldpi-v4/drawable/icon.png #generated)
    (new resource id icon from xhdpi-v4/drawable/icon.png #generated)
Aborted (dump written)

The exit code is 134, couldn't find anything about it

Thanks

Edit

All the resources are used in an Android Studio project. As that one compiles without any issues i assume the resources are valid

(seems to be a problem with aapt or xml parsing, i think gradle replaces aapt's tasks in Android Studio)

Also, since it could also be a system specific issue, here are my specs:

Edit - Contents of AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.company.app"> <!-- Of cause different but no special chars -->
    <application
        android:allowBackup="true"
        android:icon="@drawable/icon" <!-- With this line, crashes -->
        android:label="Title" <!-- Again different title but only english letters -->
        android:supportsRtl="true"
        android:testOnly="false">
        <activity android:name="immerse.MAct">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>
</manifest>

Update

Tried again without @drawable/icon but with resources. Still crashing.

So it doesn't seem to be an xml issue

Upvotes: 0

Views: 395

Answers (2)

Leso_KN
Leso_KN

Reputation: 176

Solved! For me the problem has solved now. My solution was to install a newer version of aapt and all it's dependencies from debian sid.

The command now runs without an error!

I downloaded all required files from here and here starting with package aapt of course, dpkg will tell you dependencies (some can be installed via apt)

Thanks to these sites!

Upvotes: 0

Rob
Rob

Reputation: 1057

Try to adjust your images size(make them lower) it seem they are in very large resolution and they take much more memory.

Upvotes: 2

Related Questions