Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7750923
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T11:25:00+00:00 2026-06-01T11:25:00+00:00

I am trying to include cocos2d into a preexisting app. I’ve done things the

  • 0

I am trying to include cocos2d into a preexisting app. I’ve done things the Eclipse way, such as setting “isLibrary” and adding the library project to the build path in Eclipse, and I have the following dependency in my app’s pom.xml:

<dependency>
    <groupId>cocos2d_android</groupId>
    <artifactId>cocos2d_android</artifactId>
    <version>1.0.0-SNAPSHOT</version>
    <scope>provided</scope>
</dependency>

I thought this would’ve taken care of the issue, but when I build, the library seems not to be included. I know this because when I start an Activity, SimpleGame, referencing one of the classes in the cocos2d source, the Activity dies and I get this stacktrace in DDMS:

E/AndroidRuntime(10621): FATAL EXCEPTION: main
E/AndroidRuntime(10621): java.lang.NoClassDefFoundError: org.cocos2d.opengl.CCGLSurfaceView
E/AndroidRuntime(10621): at com.xyz.game.SimpleGame.onCreate(SimpleGame.java:22)
...

I’m looking for two things:

1) a reliable way to see if a certain class/jar/whatever was packaged up into my apk, as the steps to get to this point in my app are long and complicated right now

2) Something in the Manifest or pom.xml for either the main app or the library project seems to be missing – something needed to signal to Maven to pick up this other project – what is it?

I’m using Maven 3.0.4 and 3.0.0-alpha-13 of the plugin, building for level 8 and up.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T11:25:01+00:00Added an answer on June 1, 2026 at 11:25 am

    1) a reliable way to see if a certain class/jar/whatever was packaged up into my apk, as the steps to get to this point in my app are long and complicated right now

    Build project from command-line (i.e. mvn clean install), maven will output verbose logs during every single phase/goal of build, in the dex goal, you can see something like this:

    [INFO] — android-maven-plugin:3.1.1:dex (default-dex) @ myproject —
    [INFO] C:\Program Files\Java\jdk1.6.0_21\jre\bin\java [-Xmx1024M, -jar, C:\Progr
    am Files\Android\android-sdk-r16\platform-tools\lib\dx.jar, –dex, –output=C:\workspace\myproject\target\classes.dex, C:\workspace\myproject\target\classes, C:\maven\repository\cocos2d_android\cocos2d_android\1.0.0-SNAPSHOT\cocos2d_android-1.0.0-SNAPSHOT.apklib, C:\maven\repository\com\google\code\gson\gson\1.7.1\gson-1.7.1.jar, … …]

    The Android Library Project is actually dex-ed as cocos2d_android-1.0.0-SNAPSHOT.apklib with some other regular jar library archives.


    2) Something in the Manifest or pom.xml for either the main app or the library project seems to be missing – something needed to signal to Maven to pick up this other project – what is it?

    It is ApkLib, which is simply a zip archive of the Android Library Project (src/, res/, AndroidManifest.xml and etc.). We usually create/implement our own Android Library Project with the dependant Android Project as multi-module maven project, however, this is not necessary in case if you need reference Android Library Project written by other developers. Thanks to the developer, android-maven-plugin has already supported non-Maven Android Library Projects, check out Compatible with non-Maven Android Library Projects:

    The generated .apklib file will have the layout of a standard Android/Eclipse library project. This means that regardless of your Maven layout, the layout inside the .apklib file will be that source code is in "src/" instead of "src/main/java/", but still interpreted correctly when used in an Android/Maven application project. This is to be compatible with non-Maven developers’ library projects, which is important to grow the Android developer community.

    Use other non-Maven developers’ libraries

    It also means we can take any external Android library project zip file (from non-Maven developers) and do mvn install:install-file … on it and simply start using it as a dependency.

    Share your .apklib with non-Maven developers

    To share your .apklib file with a non-Maven developer, they will probably feel more comfortable if you rename it to .zip. They can then simply unpack it in a directory and use it from there.

    So the workaround is:

    1. Pack your Android Library Project into zip archive properly, then rename it to something.apklib.

    2. Install something.apklib into your Maven local repository by using mvn install:install-file.

    3. In any Android Project that requires Library dependency, simply using:

      <dependency>
        <groupId>cocos2d_android</groupId>
        <artifactId>cocos2d_android</artifactId>
        <version>1.0.0-SNAPSHOT</version>
        <type>apklib</type>
      </dependency>
      

    Check out Samples on android-maven-plugin website to see how to use apklib properly.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to include in my Windows Form App a way that when user
I am trying to include a .js file into a php file. My folder
I am trying to include a version of Eclipse in an installation package, that
I'm trying to include Matlab shared library in python, if first I'm adding the
I am trying to include the pyOpenSSL package into an executable from a virtual
I've been trying to include C Igraph libraries in c++(On eclipse), this code works
I'm trying to include a premade messageboard, Phorum, into one of my Zend projects.
I'm trying to include plCrashReporter in my iPhone app using the code found here:
I am trying to include my cascading style sheet into my TYPO3 extension. I
I'm trying to include the font KaiTi while setting text on the clipboard, so

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.