1

我创建了一个显示广告的简单应用程序。我使用了 BlackBerry 开发指南“创建显示广告的 BlackBerry 应用程序”。我按照所有步骤操作,但在 BlackBerry 9900 模拟器上出现 NoClassDefFound 错误。我已经从developer.blackberry.com/appworld/advertising

为此,我使用了 preverify.exe 来检查 jar 文件是否与 net_rim_api.jar 兼容:

在我的 CMD 上:

preverify -classpath "D:\Eclipse\plugins\net.rim.ejde.componentpack7.1.0_7.1.0.10\com ponents\lib\net_rim_api" "net_rim_bbapi_adv_app.jar" "D:\Eclipse\plugins\net.rim. ejde.componentpack7.1.0_7.1.0.10\components\bin\output"

我越来越这样了,我该怎么办?

错误预验证类 net.rimlib.blackberry.api.advertising.app.a java/lang/NoClassDefFoundError: java/lang/Thread

我已经从developer.blackberry.com/appworld/advertising

这是我的代码:

  import net.rim.device.api.ui.UiApplication;
        import net.rim.device.api.ui.container.MainScreen;
        import net.rimlib.blackberry.api.advertising.app.Banner;

        public class AdDemo extends UiApplication{
           public static void main(String[] args)
           {
              AdDemo theApp = new AdDemo();
              theApp.enterEventDispatcher();
           }

           public AdDemo()
           {
              pushScreen(new AdDemoScreen());
           }

        }

        class AdDemoScreen extends MainScreen{

           public AdDemoScreen()
           {
               Banner bannerAd = new Banner(16741, null);
               bannerAd.setMMASize(Banner.MMA_SIZE_EXTRA_LARGE);            
               add(bannerAd);
           }

        }

我该如何克服这个问题?

4

1 回答 1

0

将添加到您的黑莓应用程序

您可以检查以下代码:

import net.rim.device.api.system.Bitmap;
import net.rim.device.api.ui.Field;
import net.rim.device.api.ui.Manager;
import net.rim.device.api.ui.component.Dialog;
import net.rim.device.api.ui.container.HorizontalFieldManager;
import net.rim.device.api.ui.container.MainScreen;
import net.rim.device.api.ui.container.VerticalFieldManager;
import net.rim.device.api.ui.UiApplication;
import net.rimlib.blackberry.api.advertising.app.Banner;
public class AdDemo extends UiApplication {
 public static void main(String[] args) {
  AdDemo theApp = new AdDemo();
  theApp.enterEventDispatcher();
 }
 public AdDemo() {
  pushScreen(new AdDemoScreen());
 }
}
class AdDemoScreen extends MainScreen {
 final Banner bannerAd;
 public AdDemoScreen() {
  Bitmap bit = Bitmap.getBitmapResource("BannerAd.png");
   bannerAd = new Banner(85983, null,60000 , bit);  bannerAd.setMMASize(Banner.MMA_SIZE_EXTRA_EXTRA_LARGE);
  VerticalFieldManager vfm = new VerticalFieldManager(    Manager.NO_VERTICAL_SCROLL | Manager.NO_VERTICAL_SCROLLBAR
      | Field.USE_ALL_WIDTH);
  HorizontalFieldManager hfm = new HorizontalFieldManager(
    Field.FIELD_HCENTER | Field.FIELD_VCENTER);
  hfm.add(bannerAd);
  vfm.add(hfm);
  add(vfm);
  bannerAd.setFocus();
 } 
 protected boolean navigationClick(int status, int time) {
  if (bannerAd.isFocus()) {
   Dialog.alert("Hellloooo");
  }
  return true;
 }
}
于 2012-11-10T18:45:59.013 回答