1
我已經試了好幾次讓索尼的小應用程式SDK示例項目,但我不能得到它的工作:如何讓Sony Small App SDK示例項目正常工作?
每次我用它,我得到的錯誤:
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清單
<?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>
任何幫助真的好評
嗨 - 看起來像是索尼圖書館。我使用網站下載的方式重新下載它,並將其作爲外部jar添加並運行。 - 感謝皮特幫助診斷 –
很高興聽到它的工作! – Pete