In eclipse, if you press CTRL and click the method name, you can open declaration or implementation of this method. I want to use this idea to navigate to a class in android manifest.xml.
All other Activity or Service work just fine, but only Receiver does not.
see code below
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.seafile.seadroid2"
android:versionCode="20"
android:versionName="1.0.1"
android:installLocation="internalOnly"
>
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="17" />
<application
android:allowBackup="true"
android:name="com.seafile.seadroid2.SeadroidApplication"
android:label="#string/app_name"
android:icon="#drawable/ic_launcher">
<receiver android:name=".OSBootReceiver" >
<intent-filter>
<category android:name="android.intent.category.DEFAULT" />
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>
<activity android:name="com.seafile.seadroid2.BrowserActivity"
android:label="#string/app_name"
android:theme="#style/Theme.SeafileTheme"
android:launchMode="singleTask">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<service android:name="com.seafile.seadroid2.sync.CameraUploadService" > </service>
</application>
</manifest>
I checked if the path was right, the class exists in that path, so why can't I click to open that class?
Anyone can help?
Your receiver is not using the full path. Try changing the declaration from:
<receiver android:name=".OSBootReceiver" >
...
</receiver>
to:
<receiver android:name="com.seafile.seadroid2.OSBootReceiver" >
...
</receiver>
I've found that Eclipse will only respond to a ctrl-click in a manifest file if the name is fully qualified.
Controls if all the check are enabled.
see
General > Editors > Text Editors > Hyperlinking preference page.
Related
This is my AndroidManifiest.xml File
Their is 2 error
no resource identifier found for attribute 'launchmode' in package android
no resource identifier found for attribute 'stateNotNeeded' in package android
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="a52.puri.fbkunal.com.launcher">
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#android:style/Theme.Wallpaper.NoTitleBar.Fullscreen"
android:launchMode="singleTask"
android:stateNotNeeded="true"
android:
>
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.HOME" />
</intent-filter>
</activity>
</application>
</manifest>
You are assigning unknown property for application tag, launchMode in android is for Activities. Activities launch and visible to user but Application launch only once when you start your App. You can say Application is a start point in Android App.
Assign a launchMode into Activity not in application tag.
Basically we could assign a launchMode directly as an attribute of <activity> tag inside AndroidManifest.xml file list this:
<activity
android:name=".SingleTaskActivity"
android:label="singleTask launchMode"
android:launchMode="singleTask">
So I have very weird problem with android app that I developed that I really do not understand how to address.
Description of the problem: When I run the app in my emulator(and many other emulators) the app works perfectly, but when I list it on Google Play and some user download the app, it automatically crashes. so I just wonder if my androidmainfest is properly written.
*the program written in esclipse, java, android.
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.app"
android:versionCode="6"
android:versionName="1.5" >
<uses-sdk
android:minSdkVersion="9"
android:targetSdkVersion="21" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<meta-data android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
<activity
android:name="com.example.MainActivity"
android:label="#string/app_name"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.example.SurfaceExampleView"
android:label="#string/app_name"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="com.example.start" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name="com.example.RulesGame"
android:label="#string/app_name" >
<intent-filter>
<action android:name="com.example.rules" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name="com.example.PolicyGame"
android:label="#string/app_name" >
<intent-filter>
<action android:name="com.example.policy" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name="com.example.RevenueGame"
android:label="#string/app_name" >
<intent-filter>
<action android:name="com.example.revenue" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name="com.example.ShopGame"
android:label="#string/app_name" >
<intent-filter>
<action android:name="com.example.shop" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity android:name="com.google.android.gms.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
android:theme="#android:style/Theme.Translucent"/>
</application>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
</manifest>
You have posted only your manifest and not the logs. My guesses based on that is the problem may be within your package declaration, rest everything seems fine.
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.app".....
The package should be unique and its like what we call package in java world. You have declared it as com.app whereas your app is using com.example.... package. Also com.app maybe used by other app.The package name defines your application's identity.
Once you publish your application, you cannot change the package name. As the package name defines your application's identity, so if you change it, then it is considered to be a different application and users of the previous version cannot update to the new version. So you may have to upload another app with different package name.
Try getting logs(use crashlytics) for your crash and we can look into it for the root cause.
Problem: I'm developing content display app. Now I want to enable GCM push notification app, for that I downloaded a sample project from
http://www.androidhive.info/2012/10/android-push-notifications-using-google-cloud-messaging-gcm-php-and-mysql/
The sample project is working fine and notification are coming as expected.
Now I copy pasted the following files to my project
1. manifest file
2. xml file
3. values file
4. MainActivity file
I changed the Packagename that I need from the pervious code that I copied but still it is not working. Please guide me which line i should change the packagename of project , where I should use class packagename and in where i should use the project packagename.
It is giving me error because the package name and sub package name are same.
Code:
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name" >
<!-- Register Activity -->
<activity
android:name="com.androidhive.pushnotifications.RegisterActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<!-- Main Activity -->
<activity
android:name="com.androidhive.pushnotifications.MainActivity"
android:configChanges="orientation|keyboardHidden"
android:label="#string/app_name" >
</activity>
<receiver
android:name="com.google.android.gcm.GCMBroadcastReceiver"
android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
<!-- Receives the actual messages. -->
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<!-- Receives the registration id. -->
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name="com.androidhive.pushnotifications" />
</intent-filter>
</receiver>
<service android:name="com.androidhive.pushnotifications.GCMIntentService" />
</application>
being a newbie in android development, I'm not able to figure out which is the main package name in this code.
Any suggestion would be great!. thanks in advance
We add it like this:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mymain.package"
android:versionCode="1"
android:versionName="1.0" >
Sarthak Mittal is right, but you also need to change your manifest for main activity:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mymain.package"
android:versionCode="1"
android:versionName="1.0" >
<activity
android:name="com.androidhive.pushnotifications.MainActivity"
android:configChanges="orientation|keyboardHidden"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Hi there basically i have created a options menu and have one of the menu items as the home button which essentially calls the home activity Main.java. I have used the code
startActivity(new Intent("org.me.myandroidstuff.Main"));
in a GetHome method. My problem is that when i run this the application crashes because it isnt handled. Now i know this generally means there is some error in the androidmanifest file however i think my coding is okay so im a bit stumped. Here is my androidmanifest.xml code
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.me.myandroidstuff"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="19" />
<uses-permission android:name="android.permission.INTERNET" />
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name" android:allowBackup="false">
**<activity
android:name=".Main"
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=".PetrolPriceActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="org.me.myandroidstuff.PetrolPriceActivity" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name=".AreaURL"
android:label="#string/app_name" >
<intent-filter>
<action android:name="org.me.myandroidstuff.AreaURL" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application>
</manifest>
the part highlighted is the code for my main class. Im rather new to android so i imagine its a relatively simple fix but ive looked and i havent found a solution yet. Thanks
change the code to
startActivity(new Intent("android.intent.action.MAIN"));
In manifest file in action you have written
< action android:name="android.intent.action.MAIN" />
while calling the new Intent(String Action), you need to put the same action name.
or you can use different signature of constructor,
change the code to
startActivity(new Intent(this, Main.class);
in place of "this" you can use the appropriate context.
use startActivity(new Intent(getApplicationContext(), Main.class));
I have an Android widget (it is shown in the list of widgets on the phone, and is not shown in the list of apps). It has a button which launches a pop-up activity.
Now I would like to change the widget so, that it would be both an app (which will be shown in the list of apps on the phone) which will start from that pop-up activity, and a widget (the same as before) which will launch the app (which will consist of that pop-up activity, but will be displayed and treated like an app).
What changes should I make in my manifest file to make the changes described above?
Below is my manifest file:
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="15" />
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#android:style/Theme.Light.NoTitleBar" >
<receiver android:name="myapp.myapp.MyWidgetProvider" >
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
<meta-data
android:name="android.appwidget.provider"
android:resource="#xml/demo_widget_provider" />
</receiver>
<receiver
android:name="myapp.myapp.MyWidgetIntentReceiver"
android:label="widgetBroadcastReceiver" >
<intent-filter>
<action android:name="GET_HELP" />
<action android:name="CHANGE_PICTURE" />
</intent-filter>
<meta-data
android:name="android.appwidget.provider"
android:resource="#xml/demo_widget_provider" />
</receiver>
<activity
android:name="myapp.myapp.MainActivity"
android:label="#string/title_activity_main" >
</activity>
<activity
android:name="myapp.myapp.CardsChoice"
android:label="#string/title_activity_choice" >
</activity>
</application>
The solution was rather simple: I just needed to add a Launcher Activity to the app.
This operation consists of 2 steps:
Adding activity definition as a launcher activity to the Manifest
Example:
<activity
android:name="package.package"
android:label="#string/title_activity_main"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Adding code of the activity (and the layout) to the app.
It is about an class MainActivity and a layout file activity_main.xml