Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The constructor BitmapTexture(TextureManager) is undefined #7

Open
alexkempton opened this issue Mar 6, 2012 · 4 comments
Open

The constructor BitmapTexture(TextureManager) is undefined #7

alexkempton opened this issue Mar 6, 2012 · 4 comments

Comments

@alexkempton
Copy link

Error on line 69 of SpriteExample, "The constructor BitmapTexture(TextureManager) is undefined". Seems to be related to changes of the constructors of AndEngine's BitmapTexture in the beginning of march.

@alexkempton
Copy link
Author

By looking at Niffy's fix at nicolasgramlich/AndEngineTexturePackerExtension#2, there seems to be an easy fix. The solution is to change onCreateResources() in SpriteExample.java to:

@Override
public void onCreateResources() {
    try {
        this.mTexture = new BitmapTexture(this.getTextureManager(),  new IInputStreamOpener() {
            @Override
            public InputStream open() throws IOException {
                return getAssets().open("gfx/face_box.png");
            }
        });

        this.mTexture.load();
        this.mFaceTextureRegion = TextureRegionFactory.extractFromTexture(this.mTexture);
    } catch (IOException e) {
        Debug.e(e);
    }
}

@tauame
Copy link

tauame commented Mar 12, 2012

to get this fix working, it is also needed this import:

import org.andengine.util.adt.io.in.IInputStreamOpener;

@kpsfoo
Copy link

kpsfoo commented Mar 12, 2012

I tried the above fix but while the AndEngine Examples force close before starting....Here is my logcat,

03-13 04:50:47.611: E/AndroidRuntime(8241): FATAL EXCEPTION: main
03-13 04:50:47.611: E/AndroidRuntime(8241): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{org.andengine.examples/org.andengine.examples.launcher.ExampleLauncher}: java.lang.ClassNotFoundException: org.andengine.examples.launcher.ExampleLauncher in loader dalvik.system.PathClassLoader[/data/app/org.andengine.examples-1.apk]
03-13 04:50:47.611: E/AndroidRuntime(8241): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1680)
03-13 04:50:47.611: E/AndroidRuntime(8241): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1784)
03-13 04:50:47.611: E/AndroidRuntime(8241): at android.app.ActivityThread.access$1500(ActivityThread.java:123)
03-13 04:50:47.611: E/AndroidRuntime(8241): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:939)
03-13 04:50:47.611: E/AndroidRuntime(8241): at android.os.Handler.dispatchMessage(Handler.java:99)
03-13 04:50:47.611: E/AndroidRuntime(8241): at android.os.Looper.loop(Looper.java:130)
03-13 04:50:47.611: E/AndroidRuntime(8241): at android.app.ActivityThread.main(ActivityThread.java:3835)
03-13 04:50:47.611: E/AndroidRuntime(8241): at java.lang.reflect.Method.invokeNative(Native Method)
03-13 04:50:47.611: E/AndroidRuntime(8241): at java.lang.reflect.Method.invoke(Method.java:507)
03-13 04:50:47.611: E/AndroidRuntime(8241): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:847)
03-13 04:50:47.611: E/AndroidRuntime(8241): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:605)
03-13 04:50:47.611: E/AndroidRuntime(8241): at dalvik.system.NativeStart.main(Native Method)
03-13 04:50:47.611: E/AndroidRuntime(8241): Caused by: java.lang.ClassNotFoundException: org.andengine.examples.launcher.ExampleLauncher in loader dalvik.system.PathClassLoader[/data/app/org.andengine.examples-1.apk]
03-13 04:50:47.611: E/AndroidRuntime(8241): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
03-13 04:50:47.611: E/AndroidRuntime(8241): at java.lang.ClassLoader.loadClass(ClassLoader.java:551)
03-13 04:50:47.611: E/AndroidRuntime(8241): at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
03-13 04:50:47.611: E/AndroidRuntime(8241): at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
03-13 04:50:47.611: E/AndroidRuntime(8241): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1672)
03-13 04:50:47.611: E/AndroidRuntime(8241): ... 11 more
03-13 04:51:32.902: E/jdwp(8341): Failed sending reply to debugger: Broken pipe

What did I do wrong?

@tauame
Copy link

tauame commented Mar 13, 2012

I don't believe this issue alexkempton reported has anything to do with your error, perhaps you should try the andengine forums.

It seems like your project has some kind of configuration (project properties or androidManifest.xml) error, in you place i would try to get it from the repository again and re-run it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants