Android Studio gets package name wrong when running .apk

I tried to restart Android Studio but the problem still existed. Then the solution works with me. Remove the directory ~/.gradle/caches/. It’s OK to do this while Android Studio is opened. (Refer pm installing wrong package name) Press “Sync project with Gradle files” icon on Android Studio Run the project and the remote path will … Read more

What’s the “dot” for when registering an Activity

As you have noticed the point is not necessary but it basically means: the activity class lives in the same package of the app. So, if your app package is: com.my.package then: .YourActivity means that your class is inside com.my.package. YourActivity means that your class is inside com.my.package (same as above). .activities.YourActivity means that your … Read more

Debugging a service

Here’s what you can do in four steps: First: In the first interesting method of your service (I used on create): /* (non-Javadoc) * @see android.app.Service#onCreate() */ @Override public void onCreate() { super.onCreate(); //whatever else you have to to here… android.os.Debug.waitForDebugger(); // this line is key } Second: Set break points anywhere after the waitForDebugger … Read more

Could not identify launch Activity: Default Activity not found

For main activity in your manifest you have to add this with category LAUNCHER (First Activity on launch app): <activity android:name=”.MainActivity” android:label=”YourAppName” android:theme=”@style/AppTheme.NoActionBar” > <intent-filter> <action android:name=”android.intent.action.MAIN” /> <category android:name=”android.intent.category.LAUNCHER” /> </intent-filter> </activity> For other activity you have to change category to DEFAULT: <activity android:name=”.OtherActivity” android:theme=”@style/AppTheme.NoActionBar” > <intent-filter> <action android:name=”package.OtherActivity” /> <category android:name=”android.intent.category.DEFAULT” /> </intent-filter> … Read more

What’s the difference between access network state (ACCESS_NETWORK_STATE) and WIFI state (ACCESS_WIFI_STATE) permissions?

android.permission.ACCESS_NETWORK_STATE is needed for accessing ConnectivityManager (mainly for monitoring network connections in general), while android.permission.ACCESS_WIFI_STATE grants access to WifiManager (for managing all aspects of Wi-Fi connectivity in particular).

How to use custom permissions in Android?

I created a test code you can use it and test your permissions. There are two applications PermissionTestClient which declares permission and protects its activity with this permission. Here is its manifest file: <?xml version=”1.0″ encoding=”utf-8″?> <manifest xmlns:android=”http://schemas.android.com/apk/res/android” package=”com.testpackage.permissiontestclient” android:versionCode=”1″ android:versionName=”1.0″ > <uses-sdk android:minSdkVersion=”10″ /> <permission android:name=”com.testpackage.mypermission” android:label=”my_permission” android:protectionLevel=”dangerous”></permission> <application android:icon=”@drawable/ic_launcher” android:label=”@string/app_name” > <activity android:permission=”com.testpackage.mypermission” … Read more

add ‘tools:replace=”Android:value”‘ to element at AndroidManifest

Problem is that all support libraries with same version and major version has to match compile SDK version. So try to force a specific support library version. Put this at the end of your app module in build.gradle. configurations.all { resolutionStrategy.eachDependency { DependencyResolveDetails details -> def requested = details.requested if (requested.group == ‘com.android.support’) { if … Read more

You can’t submit updates as some information about your app is incomplete (Google Play)

After contacting Google Play support they replied and said that if you use analytics we need to choose YES on The AD_ID permission for an analytics use case on the Advertising ID section. You should not remove permission manually or remove analytics sub-modules that contain AD_ID permission since it can break things… So just need … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)