2

I'm trying to create a plugin for Unity3D using Android Studio.

I can show a simply toast using this plugin, but I cannot get working the printer service.

This is my code:

void PrintThis(byte[] data){
    Bitmap bm = BitmapFactory.decodeByteArray(data,0,data.length);
    PrintHelper helper = new PrintHelper(UnityPlayer.currentActivity);
    helper.setScaleMode(PrintHelper.SCALE_MODE_FIT);
    helper.printBitmap("test print",bm);
}

When I call this method I get an error: NoClassDefFoundError: Failed resolution of Landroid/support/v4/print/PrintHelper

What am I doing wrong? I'm testing on an Android 5.0 device (Printing requires API level 19)

Thank you.

  • Do you have android-support-v4 downloaded into your android SDK Folder? – dambros Mar 30 '16 at 07:57
  • Yes @dambros, I have a file android-support-v4.jar in path D:\_Android\sdk\extras\android\support\v4. In the gradle file (I don't know the exact name) I have this text: dependencies { compile fileTree(include: ['*.jar'], dir: 'libs') testCompile 'junit:junit:4.12' compile 'com.android.support:appcompat-v7:23.1.1' compile 'com.android.support:design:23.1.1' compile files('libs/classes.jar') compile 'com.android.support:support-v4:23.1.1' } – Victor Pinto Mar 30 '16 at 15:22

0 Answers0