I am a beginner at android, however I have tried developing simple android apps using IntelliJ idea. But when I tried developing sony small apps in IntelliJ idea, it does not work. When I try to run the application it say MainActivity is not a type of Activity.
My MainActivity extends SmallApplication provided by the Sony SDK.
Has anybody tried using sony small apps sdk with intelliJ idea or is there any work around for it to work..??
Just verify your code as below,
import android.app.Activity;
public class MainActivity extends Activity {
//Your body element
}
Extend Activity with you main activity
File -> Project Structure -> Libraries add and link to jar file
Then add the jar to the libs folder of your project so it is compiled with the apk. Otherwise it will not run on your device.
Ok, I figured our the everytime you click the run application button and choose a device, IntelliJ tries to install and app and start the main activity. So I set the run configuration to 'Do not Launch Activity', which helped solve my problem.
So now when I 'Run' my application, IntelliJ opens up the emulator and installs my app. Because Sony Small applications have to be run through a special application called SmallApps launcher, I manually run the application.
Small apps is a service NOT an activity. You need to edit the manifest and replace the activity to service ..see the correct manifest for small app:
<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>
Related
I cleared all the bugs... Recently before running this app it was showing "No default activity found" I changed configuration to "Nothing" & also added Android Manifest.xml file.
After successful build, Emulator shows app in settings>>app management.
But,
There is nothing in Apps Menu. Even I tried manually installing this app in my device. But it says "App Not Installed"
Share your experience. Help me out. Thank you.
Please include all manifest functions into this code, if I am missing something. This app is cloud storage app.
This is my manifest file :
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
>
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity
android:name=".activities.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>```
Sometimes android studio has quircks and bugs.
In this case when it complains of activity not found even though you know it's there do the following:
clean build - see if it works
remove cable of device reattach cable of device - see if it works
restart android studio - see if it works
invalidate caches and restart - see if it works
if none of the above work, that means you have some place in that activity that in theory compiles, in practice there is a problem with it.
Add this in your activity tag
<category android:name="android.intent.category.DEFAULT" />
I have scoured the internet for this, but none of the "answers" I have found so far have fixed it for me. My app installs and runs 100% on my phone, which runs Android 4.1.2. It appears to install ok on my tablet too, which runs Android 4.3. But when I try to run it on the tablet, I get the "Application is not installed" error. What is even stranger is that if I run it using the App Manager inside ES File Explorer, it runs fine!
So my suspicion is that Android 4.3 is more strict about something that 4.1.2 lets through. But what? I just can't find it. And why it should run from within ES File Explorer is just weird. The app manifest is below. I have tried several different values for the target SDK, but nothing makes any difference. The app is signed using the Export Wizard in Eclipse, using a certificate created there.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="marshallarts.wordfinder"
android:versionCode="10"
android:versionName="1.10" >
<uses-sdk
android:minSdkVersion="11"
android:targetSdkVersion="18" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:permission="android.permission.WRITE_EXTERNAL_STORAGE"
android:theme="#style/AppTheme"
android:hasCode="true" >
<activity
android:name=".StartActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".EnterActivity"
android:label="#string/title_activity_enter"
android:theme="#android:style/Theme.Dialog">
</activity>
<activity
android:name=".PlayActivity"
android:label="#string/title_activity_play" >
</activity>
</application>
</manifest>
Would add as a comment but don't have enough rep at the moment.
Have you changed your default launcher activity in your project recently? It could be that the link in your Android Home application is referencing the old activity.
Well I have solved this at last. It was (of course) my error - I had not correctly understood how to specify the app's permissions, and had not set them properly in the manifest. Corrected that, and it now runs happily. It is still a minor mystery why it ran on my phone - seems to me it should not have - but no matter, I am now on the right track.
I created a new blank activity from Eclipse's 'New' menu.
I didn't get any errors, and the activity looks to have been correctly populated in the manifest, however, no java class file has been created.
I get the impression that within Eclipse, the class should have been auto-created and auto-populated with the onCreate and onOptionsItemSelected method templates.
Why didn't Eclipse automatically create the class for me?
Manifest code as requested:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.myfirstandroidapp"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="16" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.example.myfirstandroidapp.MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.example.myfirstandroidapp.DisplayMessageActivity"
android:label="#string/title_activity_display_message"
android:parentActivityName="com.example.myfirstandroidapp.MainActivity" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.example.myfirstandroidapp.MainActivity" />
</activity>
</application>
The fastest solution: keep the Activity in your manifest, but create the java class by right-clicking your package -> new -> class -> DisplayMessageActivity and then extend the Activity class and add the missing methods. Note that the class name have to match the one declared in the manifest
EDIT
After you've done it, clean the project by selecting project -> clean and check if there are any error messages left
I needed to uninstall Eclipse and install the sdk (adt bundle) from http://developer.android.com/ which comes bundled with eclipse to resolve this issue.
I found that my original set-up not only failed to create source files, but was also unable to create new android projects, even though it managed to create the first project successfully. Something must have happened to ruin the set up, no doubt, something I did but cannot trace.
What worked for me...
In eclipse, go to Help >
Install new software... > Work with: https://dl-ssl.google.com/android/eclipse/
Hit enter, checkmark "Developer Tools" and "NDK Plugins".
Let it download and install. I had to delete "myfirstapp" and remake it.
Restart Eclipse once it has downloaded and installed.
Having that issue and actually doing it over again helped me understand more about the syntax used in the lessons that I've already been through before.
I have recently started to face this issue that when I Run my application on AVD or Real Android Device via Eclipse it shows that app has been installed but does not launch. When I go and check the phone/AVD it does not show that app in the Apps area but when I go to "Manage Apps" here I can see my app is installed. Is there any reason why its happening?
All the help is much appreciated.
Thanks in Advance.
Ali
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.game.bond.of.jungle"
android:versionCode="1"
android:versionName="1.0" >
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme"
>
<activity
android:name=".MainActivity"
android:label="#string/title_activity_main"
android:theme="#android:style/Theme.Black.NoTitleBar" >
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="androidintent.category.LAUNCHER"/>
</intent-filter>
</activity>
</application>
Probably your main activity is missing the correct intent filters. Make sure it is declared like this:
<activity android:name="com.your.package.YourLauncherActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
Are you sure that you have set the right Run Configuration?
Right Click your project
Choose Run As
Choose Run Configuration
Check Launch Default Activity
Hit Apply and Ok
I was having the same problem, but for some reason the Launch Default Activity did not work. I thought I messed something up in the AndroidManifest.xml after adding a search intent filter in the project, but that was not the problem. It would not let me debug either, although the app would start fine when launched from the device.
This worked for me:
Right-click on the project
Select Run As
Select Run Configurations...
Select your application from the list on the left
Manually select Launch: MainActivity (or whatever you have it named) as the Launch Action instead of the default
Select apply
Number one thing to check in a situation like this is, look around the AndroidManifest.xml file. Most of the time,
if you had imported a project from SVN, Git or from existing source code your AndroidManifest.xml file might have replaced with a new one which doesn't specify which Activit(y)ies.java files are there and which one to bring up as the Launcher activity.
I've just started trying to set up some unit testing in what is essentially my first android app. I've had a hell of a time finding resource for this, but ultimately was able to scrape together what I hoped was the right path forward.
First, this is what I've done.
In Eclipse, I right-clicked my project that I'd like to create a test project for.
I selected AndroidTools -> New Test Project
I filled out the necessary information selecting a location of ../MyApp/tests for the new project and selected MyApp as the project to test. Everything else was left as default.
While this was executing I received the below as an error:
[2011-04-01 08:13:02 - WPMSTest] R.java was modified manually! Reverting to generated version!
But everything seemed okay. I had a new source tree in my tests folder.
So I tried to execute it (first on hardware, then on the emulator) by RunAs -> Android jUnit test.
In both runs I received the below in my eclipse console:
[2011-04-01 08:23:04 - WPMSTest] Launching instrumentation android.test.InstrumentationTestRunner on device emulator-5554[2011-04-01 08:23:04 - WPMSTest] Failed to launch test
My two manifest files:
WPMSTest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.WPMS.test"
android:versionCode="1"
android:versionName="1.0">
<instrumentation android:targetPackage="com.WPMS" android:name="android.test.InstrumentationTestRunner" />
<application android:icon="#drawable/icon" android:label="#string/app_name">
<uses-library android:name="android.test.runner" />
</application>
WPMS:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.WPMS"
android:versionCode="1"
android:versionName="1.0">
<application android:label="#string/app_name" android:icon="#drawable/ic_launcher_wpms">
<activity android:name=".WPMS"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
I'm hoping someone has seen something like this before and can shed some light on what I'm doing wrong. Please let me know if you need any more files and I'll be sure to post them.
Thanks!
I was missing a TestSuite in my Test Project. Once I had my AllTests class extend TestSuite I got past the error.
For me the problem was that I was using JUnit 4. When I changed to JUnit 3 it started working. I hope this helps.
[2011-04-01 08:13:02 - WPMSTest] R.java was modified manually! Reverting to generated version!
You get this error when you manually make changes in the R.java file. At times, when you clean the project, R.java file goes missing. At such occasion you must either copy the same program's R.java(if stored somewhere as a copy) or create an entire new project.
For your second issue, I too have got similar error when I was testing my app on the device. I had to make changes in the shell using $adb. then the device got recognised.
I had the same problem: JUnit 3 TestCase works, but when running JUnit 4 TestCase, I got "Failed to launch test" error.
But after following Ken's suggestion, i.e. make the JUnit 4 test class extends TestCase, and rename the test method with the "test" prefix, the test launches and runs the test!