wakelock is missing permission but i set it in the manifest - android

I am trying to use the wakelock feature but when I run my app i get an exception saying
java.lang.SecurityException: Neither user 10057 nor current process has android.permission.WAKE_LOCK. I copied the exact permission from the android website so I have no idea what could be wrong.
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".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=".secondscreen"></activity> <!--this allows for multiple screens -->
<activity android:name=".processing"></activity>
<activity android:name=".thirdscreen"></activity>
<activity android:name=".fourthscreen"></activity>
<activity android:name=".rewrite"></activity>
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
</application>

Move your <uses-permission> elements to appear before the <application> element:
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".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=".secondscreen"></activity> <!--this allows for multiple screens -->
<activity android:name=".processing"></activity>
<activity android:name=".thirdscreen"></activity>
<activity android:name=".fourthscreen"></activity>
<activity android:name=".rewrite"></activity>
</application>

Related

AAPT: error: unexpected element <activity> found in <manifest>

I'm using an updated version of android studio, while the code is in a previous version, I need help, I've tried everything from trying a doungrage, and I've looked at several videos, and none have given me the answer I'm looking for, I looked the entire code to see if I found any indentation flaws or sla, something that could point to some other error, and nothing, I'm slightly desperate plz help me
<?xml version="1.0" encoding="utf-8"?>
<activity
android:name=".MainActivity"
android:noHistory="true"/>
<category android:name="android.intent.category.BACK"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.MONKEY"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_INTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_INTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<application
android:allowBackup="true"
android:debuggable="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<activity
android:name=".LancaComandaActivity"
android:label="#string/title_activity_lanca_comanda"
android:theme="#style/AppTheme.NoActionBar"/>
<activity android:name=".EnvioDadosActivity"/>
<activity android:name=".FecharContaActivity"/>
<activity android:name=".MudardeMesa"/>
<activity android:name=".FechamentoParcial"/>
<activity android:name=".TabelaFParcial"/>
<activity android:name=".TcpServe"/>
<activity android:name=".SocektTask"/>
<activity
android:name=".SocketTask"
android:label="#string/title_activity_socket_task"
android:theme="#style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<activity
android:name=".SocketTaskRecebe"
android:label="#string/title_activity_socket_task_recebe"
android:theme="#style/AppTheme.NoActionBar">
</activity>
<activity android:name=".ConsultaPro"/>
<activity
android:name=".ConFechaParcial"
android:label="#string/title_activity_con_fecha_parcial"
android:theme="#style/AppTheme.NoActionBar"/>
<activity
android:name=".Mensagens"
android:label="#string/title_activity_mensagens"
android:theme="#style/AppTheme.NoActionBar"/>
<activity android:name=".MainConsultaPro"/>
</application>

error INSTALL_PARSE_FAILED_MANIFEST_MALFORMED

i am getting this error while i am trying to run my app on my device.
I uninstall my app and it didnt works and everything on my manifest seems ok (for me jeje)
<?xml version="1.0" encoding="utf-8"?>
<uses-permission android:name="android.permission.USE_FINGERPRINT" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity
android:name="menu.Activities.MainMenuActivity"
android:label="#string/app_name"
android:theme="#style/AppTheme.NoActionBar" />
<activity
android:name="menu.Activities.LoginActivity2"
android:label="#string/app_name"
android:theme="#style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="menu.Activities.validateInfoActivity"
android:label="Confirmar informaciĆ³n" />
<service
android:name="services.notificationService"
android:enabled="true"
android:exported="true"></service>
<provider android:name="DataBase.businessCore"
android:authorities="com.mercasavip.business.core" android:exported="true"/>
</application>
Try to change capital letters to lowcase in your package name.

change default start activity error

This is my code
<?xml version="1.0" encoding="utf-8"?>
<!-- To auto-complete the email text field in the login form with the user's emails -->
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.READ_PROFILE" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity android:name=".RegisterActivity"/>
<activity
android:name=".SplashActivity"
android:exported="true" />
<activity
android:name=".LoginActivity"/>
<activity
android:name=".MainActivity"
android:label="#string/title_activity_main" />
</application>
At the beginning, my project exported property is in the LoginActivity section.
But after I change exported="true" to SplashActivity it's not work...
I tried to change to RegisterActivity section and got the same error.
Event log is "Error running app: The activity must be exported or contain an intent-filter"
my android studio version is 2.3.3 and project min SDK is 19
Is there anyone have the same problem?..
Updare:
This is my latest code
<?xml version="1.0" encoding="utf-8"?>
<!-- To auto-complete the email text field in the login form with the user's emails -->
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.READ_PROFILE" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity android:name=".RegisterActivity"/>
<activity
android:name=".SplashActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<activity
android:name=".LoginActivity" />
<activity
android:name=".MainActivity"
android:label="#string/title_activity_main" />
</application>
But I got the
same problem
...
try defining your Splash activity like this :
<activity
android:name=".SplashActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
In the Manifest file you must have an Activity that is set as Main so the app will know what to launch first.
By adding the following intent-filters you set the following Activity as main.
<activity
android:name=".Activity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>

When inserting code in AndroidManifest.xml, my app stops

My Manifest runs like this;
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="21" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme"
>
<activity
android:name=".MainActivity"
android:label="#string/app_name"
android:theme="#android:style/Theme.NoTitleBar"
>
<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.INTERNET"/>
</manifest>
But deleting android:theme="#android:style/Theme.NoTitleBar" in activity, it works. It's about one month that I am struggling with this in Eclipse. Any advice will be welcomed.

AndroidManifest.xml - The element must be a direct child of the <application> element error

I made a copy of one of my working projects for another project. Ever since I can't get the AndroidManifest.xml to work properly. I get the error The element must be a direct child of the <application> element or The element type "manifest" must be terminated by the matching end-tag "</manifest>"error. I have refactored everything else and don't see any errors in my classes. Just the xml file is being a pain. What is wrong with this file? It looks fine and looks like my working one. Eclipse seems to think there are errors.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package= "com.mydomain.qsd"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="9"
android:targetSdkVersion="17" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="com.mydomain.qsd.permission.C2D_MESSAGE" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.VIBRATE" />
<permission
android:name="com.mydomain.qsd.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<application
android:allowBackup="true"
android:hardwareAccelerated="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" />
<activity
android:name="com.mydomain.qsd.MainActivity"
android:label="#string/app_name"
android:launchMode="singleTop"
android:screenOrientation="portrait" />
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name="com.mydomain.qsd.SplashScreen"
android:screenOrientation="portrait" />
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<receiver
android:name="com.mydomain.qsd.gcm.GCMReceiver"
android:permission="com.google.android.c2dm.permission.SEND" />
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name="com.mydomain.qsd" />
</intent-filter>
</receiver>
<service android:name="com.mydomain.qsd.gcm.GCMService"/>
<activity
android:name="com.mydomain.qsd.NotifyActivity"
android:screenOrientation="portrait"
android:label="#string/title_activity_notify" />
</activity>
</application>
</manifest>
You have directly close your application tag
Replace this :
<application
android:allowBackup="true"
android:hardwareAccelerated="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" />
by this :
<application
android:allowBackup="true"
android:hardwareAccelerated="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
EDIT :
You have to replace this :
<activity
android:name="com.mydomain.qsd.MainActivity"
android:label="#string/app_name"
android:launchMode="singleTop"
android:screenOrientation="portrait"/>
by this :
<activity
android:name="com.mydomain.qsd.MainActivity"
android:label="#string/app_name"
android:launchMode="singleTop"
android:screenOrientation="portrait" >
This :
<activity
android:name="com.mydomain.qsd.SplashScreen"
android:screenOrientation="portrait" />
by this :
<activity
android:name="com.mydomain.qsd.SplashScreen"
android:screenOrientation="portrait" >
This :
<receiver
android:name="com.mydomain.qsd.gcm.GCMReceiver"
android:permission="com.google.android.c2dm.permission.SEND" />
by this:
<receiver
android:name="com.mydomain.qsd.gcm.GCMReceiver"
android:permission="com.google.android.c2dm.permission.SEND" >
And finally this :
<activity
android:name="com.mydomain.qsd.NotifyActivity"
android:screenOrientation="portrait"
android:label="#string/title_activity_notify" />
</activity>
by this :
<activity
android:name="com.mydomain.qsd.NotifyActivity"
android:screenOrientation="portrait"
android:label="#string/title_activity_notify" />
Your application Tag and also Activity tags have self close so remove that
<application
android:allowBackup="true"
android:hardwareAccelerated="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" /> <----- remove /

Categories

Resources