我是android的初学者,但是我尝试使用IntelliJ想法开发简单的Android应用程序。但是当我尝试在IntelliJ创意中开发索尼小应用程序时,它不起作用。当我尝试运行应用程序时,它说MainActivity不是一种Activity。
My MainActivity扩展了Sony SDK提供的SmallApplication。
有没有人尝试过使用带有智能创意的sony小应用程序sdk,还是有任何解决方法可以工作...... ??
答案 0 :(得分:0)
只需验证您的代码,如下所示
import android.app.Activity;
public class MainActivity extends Activity {
//Your body element
}
使用主要活动扩展活动
答案 1 :(得分:0)
档案 - >项目结构 - >库添加并链接到jar文件
然后将jar添加到项目的libs文件夹中,以便使用apk进行编译。否则它将无法在您的设备上运行。
答案 2 :(得分:0)
好的,我想我们每次点击运行应用程序按钮并选择一个设备时,IntelliJ会尝试安装和应用并启动主要活动。所以我将运行配置设置为“不启动活动”,这有助于解决我的问题。
所以现在当我跑步'我的应用程序,IntelliJ打开模拟器并安装我的应用程序。由于Sony Small应用程序必须通过名为SmallApps启动程序的特殊应用程序运行,因此我手动运行该应用程序。
答案 3 :(得分:0)
小型应用程序不是一项服务。您需要编辑清单并将活动替换为服务..请查看小应用程序的正确清单:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.smallapp.example"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="15" />
<uses-permission android:name="com.sony.smallapp.permission.SMALLAPP" />
<application
android:icon="@drawable/ic_launcher" android:label="@string/app_name">
<uses-library android:name="com.sony.smallapp.framework" />
<service
android:name=".MainActivity"
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>