2013-06-02 2 views
1

Я несколько раз пытался получить Sony Малых приложений Примера проект SDK, но я не могу заставить его работать:Как я могу создать пример проекта Sony Small App SDK Sample Project?

Каждый раз, когда я использую его я получаю сообщение об ошибке:

06-02 10:40:13.358: E/AndroidRuntime(5903): java.lang.IllegalAccessError: Class ref in pre-verified class resolved to unexpected implementation

Я пытался переустановка его со своего веб-сайта, а также из менеджера sdk и, похоже, такая же проблема. Любой, кто может заставить его работать?

Пример проекта здесь: https://dl.dropboxusercontent.com/u/2690965/SmallAppSample.zip

Вот главный класс приложения:

public class MainApplication extends SmallApplication { 

    @Override 
    public void onCreate() { 
     super.onCreate(); 

     /* Set the content of the application */ 
     setContentView(R.layout.main); 

     /* 
     * Set the content displayed when the application is minimized. 
     * Calling this method is optional. If not called, application icon is displayed. 
     */ 
     setMinimizedView(R.layout.minimized); 

     /* Set the title of the application to be displayed in the titlebar */ 
     setTitle(R.string.app_name); 

     SmallAppWindow.Attributes attr = getWindow().getAttributes(); 

     /* Set the requested width of the application */ 
     attr.width = getResources().getDimensionPixelSize(R.dimen.width); 
     /* Set the requested height of the application */ 
     attr.height = getResources().getDimensionPixelSize(R.dimen.height); 

     /* 
     * Set the minimum width of the application, if it's resizable. 
     * 
     * If you don't have strong intention to specify minimum window size, 
     * it is preferable not to set minimum window size. 
     * If you still want to specify the minimum size, set as small value as possible 
     * to make your application work properly on the devices with small screens. 
     */ 
//  attr.minWidth = getResources().getDimensionPixelSize(R.dimen.min_width); 
     /* Set the minimum height of the application, if it's resizable */ 
//  attr.minHeight = getResources().getDimensionPixelSize(R.dimen.min_height); 

     /* Use this flag to make the application window resizable */ 
     attr.flags |= SmallAppWindow.Attributes.FLAG_RESIZABLE; 
     /* Use this flag to remove the titlebar from the window */ 
//  attr.flags |= SmallAppWindow.Attributes.FLAG_NO_TITLEBAR; 
     /* Use this flag to enable hardware accelerated rendering */ 
//  attr.flags |= SmallAppWindow.Attributes.FLAG_HARDWARE_ACCELERATED; 

     /* Set the window attributes to apply the changes above */ 
     getWindow().setAttributes(attr); 

     setupOptionMenu(); 
    } 

    @Override 
    public void onStart() { 
     super.onStart(); 
    } 

    @Override 
    public void onStop() { 
     super.onStop(); 
    } 

    @Override 
    public void onDestroy() { 
     super.onDestroy(); 
    } 

    private void setupOptionMenu() { 
     View header = LayoutInflater.from(this).inflate(R.layout.header, null); 

     final View optionMenu = header.findViewById(R.id.option_menu); 
     optionMenu.setOnClickListener(new View.OnClickListener() { 
      @Override 
      public void onClick(View v) { 
       PopupMenu popup = new PopupMenu(MainApplication.this, optionMenu); 
       popup.getMenuInflater().inflate(R.menu.menus, popup.getMenu()); 
       popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() { 
        @Override 
        public boolean onMenuItemClick(MenuItem item) { 
         Toast.makeText(MainApplication.this, 
           R.string.menu_clicked, Toast.LENGTH_SHORT).show(); 
         return true; 
        } 
       }); 
       popup.show(); 
      } 
     }); 

     /* Deploy the option menu in the header area of the titlebar */ 
     getWindow().setHeaderView(header); 
    } 
} 

Вот Android Manifest

<?xml version="1.0" encoding="utf-8"?> 

<uses-sdk android:minSdkVersion="15" /> 

<uses-permission android:name="com.sony.smallapp.permission.SMALLAPP" /> 

<application android:label="@string/app_name" > 
    <uses-library android:name="com.sony.smallapp.framework" /> 

    <service 
     android:name="MainApplication" 
     android:exported="true" > 
     <intent-filter> 
      <action android:name="com.sony.smallapp.intent.action.MAIN" /> 
      <category android:name="com.sony.smallapp.intent.category.LAUNCHER" /> 
     </intent-filter> 
    </service> 
</application> 

Любая помощь очень хорошо принят

ответ

1

Я попробовал ваш код и он работает отлично. Я думаю, что что-то не так с ссылками. Надеюсь, эта ссылка поможет. http://juristr.com/blog/2010/06/android-instrumentation-test/

+0

Hi - Похоже, что это была библиотека Sony. Я перезагрузил его, используя загрузку с веб-сайта, и добавил его как внешнюю банку, и он работает. - Спасибо Пит за помощь в диагностике –

+0

Рад слышать, что он работает! – Pete

Смежные вопросы