Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Class files of application not packaged in APK

Somehow the the android packager does not (anymore) include the class files from my application in the APK.

I have tried everything that came to my mind from comparing my settings to a sample project to reinstalling Eclipse. However, when I package the app, be it through 'Export (un)signed Application Package' or just by running it on a debug device/emulator, everything is included (jar libraries, android library projects (e.g. ActionBarSherlock)) except my own code. :-(

Here is the minimal configuration which still produces the problem...Thanks for any hints or help!

Android Manifest:

    <?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
        package="com.kawak.bla.android"
        android:versionCode="1"
        android:versionName="1.0" >

        <uses-sdk
            android:minSdkVersion="8"
            android:targetSdkVersion="17" />

        <application
            android:allowBackup="true"
            android:icon="@drawable/ic_launcher"
            android:label="@string/app_name"
            android:theme="@style/AppTheme" >
            <activity
                android:name=".activity.MainActivity"
                android:theme="@android:style/Theme.NoTitleBar" >
                <intent-filter>
                    <action android:name="android.intent.action.MAIN" />

                    <category android:name="android.intent.category.LAUNCHER" />
                </intent-filter>
            </activity>
        </application>
    </manifest>

Classpath:

    <?xml version="1.0" encoding="UTF-8"?>
    <classpath>
        <classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
        <classpathentry kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
        <classpathentry kind="lib" path="libs/json-simple-1.1.1.jar"/>
        <classpathentry kind="lib" path="libs/zbar.jar"/>
        <classpathentry combineaccessrules="false" kind="src" path="/SherlockActionBar"/>
        <classpathentry kind="src" path="src"/>
        <classpathentry kind="src" path="gen"/>
        <classpathentry kind="output" path="bin/classes"/>
    </classpath>

Eclipse project configuration:

    <?xml version="1.0" encoding="UTF-8"?>
    <projectDescription>
        <name>bla-android</name>
        <comment></comment>
        <projects>
        </projects>
        <buildSpec>
            <buildCommand>
                <name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
                <arguments>
                </arguments>
            </buildCommand>
            <buildCommand>
                <name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
                <arguments>
                </arguments>
            </buildCommand>
            <buildCommand>
                <name>org.eclipse.jdt.core.javabuilder</name>
                <arguments>
                </arguments>
            </buildCommand>
            <buildCommand>
                <name>com.android.ide.eclipse.adt.ApkBuilder</name>
                <arguments>
                </arguments>
            </buildCommand>
        </buildSpec>
        <natures>
            <nature>com.android.ide.eclipse.adt.AndroidNature</nature>
            <nature>org.eclipse.jdt.core.javanature</nature>
        </natures>
    </projectDescription>

Update: My problem was actually that ActionBarSherlock was built against Android 4.2 which somehow screwed it all without a decent error message. Luckily it is mentioned in the FAQs that you have to build it against 4.0 ... Accepting Robert's answer as he was the closest.

like image 857
Michael.F Avatar asked Nov 21 '12 17:11

Michael.F


People also ask

What is Classes DEX file in APK?

What is a Dex file? A Dex file contains code which is ultimately executed by the Android Runtime. Every APK has a single classes. dex file, which references any classes or methods used within an app.

What are the components of an APK file?

An APK file contains all of a program's code (such as . dex files), resources, assets, certificates, and manifest file. As is the case with many file formats, APK files can have any name needed, but it may be required that the file name ends in the file extension for being recognized as such.

What is Classes dex file in Android?

The classes. dex file is a Dalvik Executable file that all Android applications must have. This file contains the Java libraries that the application uses. When you deploy an application for Android, RAD Studio includes a classes. dex file that contains the RAD Studio built-in Java libraries.

Is an APK file compressed?

Android software package files, otherwise known as APKs, are compressed archives of executable code. The archive contains everything an app does, from its GUI and logic to any images it uses.


1 Answers

How do you Most likely you have a build error, and the process is not being able to complete it's job.

like image 75
Robert Estivill Avatar answered Oct 16 '22 20:10

Robert Estivill