Exception in plugin Android Support when running on device - android

I have just created a brand new android project with an single activity.
Manifest:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="de.foo.bar">
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme">
<activity
android:name="de.foo.bar.MainActivity"
android:label="#string/app_name"
android:launchMode="singleTop">
</activity>
</application>
</manifest>
Gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.0"
defaultConfig {
applicationId "de.foo.bar"
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.0.0'
compile 'com.android.support:design:23.0.0'
}
When I just build the project no error appears. However when I try to run it on a device I get following error:
Exception in plugin Android Support:
null
java.lang.AssertionError
at org.jetbrains.android.run.DefaultActivityLocator.getQualifiedActivityName(DefaultActivityLocator.java:48)
at org.jetbrains.android.run.AndroidActivityLauncher.launch(AndroidActivityLauncher.java:95)
at org.jetbrains.android.run.AndroidRunningState.doPrepareAndStart(AndroidRunningState.java:855)
at org.jetbrains.android.run.AndroidRunningState.prepareAndStartApp(AndroidRunningState.java:810)
at org.jetbrains.android.run.AndroidRunningState.prepareAndStartAppWhenDeviceIsOnline(AndroidRunningState.java:771)
at org.jetbrains.android.run.AndroidRunningState.doStart(AndroidRunningState.java:603)
at org.jetbrains.android.run.AndroidRunningState.start(AndroidRunningState.java:579)
at org.jetbrains.android.run.AndroidRunningState$2.run(AndroidRunningState.java:310)
at com.intellij.openapi.application.impl.ApplicationImpl$8.run(ApplicationImpl.java:400)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:439)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
at java.lang.Thread.run(Thread.java:695)
at org.jetbrains.ide.PooledThreadExecutor$1$1.run(PooledThreadExecutor.java:56)
Any ideas what the problem is? I am using android studio 1.4.

I think it crashed because Android Studio can't locate the default / launcher activity, this occurs due to Android studio need to have defined a default activity, and you can do that adding intent-filter to your manifest.
Your activity entry at AndroidManifest should look like:
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme">
<activity
android:name="de.foo.bar.MainActivity"
android:label="#string/app_name"
android:launchMode="singleTop">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
</application>
You can have activities without intent-filter, but you need at least one with this filter.

I had this same problem when I tried to generate the signed APK for my project, so the solution is to add this in you build.gradle file in your project:
android {
...
lintOptions {
checkReleaseBuilds false
abortOnError false
}
}

Related

APK Parsing Error

I do not know how to continue...
I build a signed or unsigned apk with Android Studio (everything is up to date). Now I want to test this apk and install it on my phone.
But I always get a parsing error...
I tried diffrent devices but with the same result. I tryed a blank app but with the same result. I can't install it because of a parsing error. But deploying directly from AS works just fine!
What I tried out:
Reinstalling SDK (latest)
Reinstalling Android Studio (latest)
Reinstalling Java (latest)
an older gradle version (2.2.3)
Dev options and allowing unknown sources are aktive on all my devices.
minSdkVersion is set to 19 (I just have devices with Android 5 and 6)
I don't have an idea where the problem comes from...
Can somebody help me?
Thanks in advance!!!
OK I finally solved my problem!
I uploaded the apk to dropbox! That was the problem!
If I move the apk directly to the download folder of my device (using USB) everything works fine!
But anyway thanks for your help!
It's not the code at all! I tried a new blank project and I couldn't install it too
but here is the Manifest and the gradle:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.brokenbricksstudios.todo"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="19"
android:targetSdkVersion="23"/>
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
<uses-permission android:name="android.permission.VIBRATE"/>
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity
android:name=".ToDo"
android:clearTaskOnLaunch="true"
android:label="#string/app_name"
android:launchMode="singleTask"
android:theme="#style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
<service android:name=".bubbles.BubblesService"
android:enabled="true"
android:exported="false" />
</application>
</manifest>
gradle:
apply plugin: 'com.android.application'
android {
signingConfigs {
TODO {
keyAlias 'TODO'
keyPassword '***********'
storeFile file('E:/AndroidStudioProjects/KeyStore.jks')
storePassword '***********'
}
}
compileSdkVersion 23
buildToolsVersion '25.0.2'
defaultConfig {
applicationId "com.brokenbricksstudios.todo"
minSdkVersion 19
targetSdkVersion 23
versionCode 1
versionName "1.0"
signingConfig signingConfigs.TODO
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.TODO
}
debug {
}
}
productFlavors {
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:design:23.4.0'
compile 'com.google.android.gms:play-services-appindexing:8.1.0'
}

MapBox SDK not working android

I just started to use the MapBox SDK but its not working I was following the steps on the documentation but Im not getting any classes from their SDK here is my code:
build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "24.0.1"
defaultConfig {
applicationId "com.mapp.hello"
minSdkVersion 15
targetSdkVersion 24
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
mavenCentral()
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.2.0'
compile ('com.mapbox.mapboxsdk:mapbox-android-sdk:4.2.0-beta.2#aar'){
transitive=true
}
}
AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest package="com.mapp.hello"
xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
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>
<service android:name="com.mapbox.mapboxsdk.telemetry.TelemetryService"/>
</application>
</manifest>
The com.mapbox.mapboxsdk.telemetry.TelemetryService is shown in red and I cannot import the MapboxAccountManager
I know it's an old question, but I just had the same error while trying to update from Mapbox 4.x to 5.x and it turns out you have to change:
<service android:name="com.mapbox.mapboxsdk.telemetry.TelemetryService"/>
to
<service android:name="com.mapbox.services.android.telemetry.service.TelemetryService" />
Update:
Turns out in the latest version (5.x) you don't have to declare it in the Manifest at all, as Mapbox now makes use of Manifest merge feature.
I dont know how but the app was getting run even though gradle build was stopped because of lint, I just stopped lint from stopping the build process now everything is working :)

VM has multidex support, MultiDex support library is disabled

I'm getting the following error.
FATAL EXCEPTION: main
VM with version 2.1.0 has multidex support
install
VM has multidex support, MultiDex support library is disabled.
install
VM has multidex support, MultiDex support library is disabled.
Shutting down VM
here is my build.gradle,i have enables the multidex in the android part,
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion '23.0.0'
defaultConfig {
applicationId "com.mycompany.newlogin"
minSdkVersion 15
targetSdkVersion 22
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
useLibrary 'org.apache.http.legacy'
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:multidex:1.0.0'
compile 'com.google.guava:guava-jdk5:17.0'
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.android.support:design:23.0.1'
//compile 'org.apache.httpcomponents:httpcore:4.4.1'
compile 'org.apache.httpcomponents:httpclient:4.5'
compile 'org.jbundle.util.osgi.wrapped:org.jbundle.util.osgi.wrapped.org.apache.http.client:4.1.2'
}
and my manifest file is
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mycompany.newlogin" >
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme"
android:name="android.support.multidex.MultiDexApplication">
<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=".Login"
android:label="#string/title_activity_login" >
</activity>
<activity
android:name=".Register"
android:label="#string/title_activity_register" >
</activity>
</application>
</manifest>
create a class lets name it App and extend from MultiDexApplication like this:
import android.support.multidex.MultiDexApplication;
public class App extends MultiDexApplication {
//you can leave this empty or override methods if you like so the thing is that you need to extend from MultiDexApplication
}
in your manifest add App as your application name just like this
<application
android:name=".App" // <<< this is the important line!
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name">
After adding everything make a clean build and it should work now :).
Override attachBaseContext method in your application class
#Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}

Android: Cannot resolve symbol ActionBarActivity

I'm getting the error "Cannot resolve the symbol ActionBarActivity" when I try to import it (import android.support.v7.app.ActionBarActivity;).
I've already read some questions ActionBarActivity cannot resolve a symbol and Import Google Play Services library in Android Studio about it and i've tried the solution described there but I couldn't fix my problem.
I tried to change the targetSdK to one lower and then I wrote back that that I had before but it didn't resolve.
I'm using Android Studio version 1.0.2.
My build.grad file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.android.asminhasdespesas"
minSdkVersion 13
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.3'
}
My Manifest file:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.asminhasdespesas" >
<uses-sdk android:minSdkVersion="13" android:targetSdkVersion="21"></uses-sdk>
<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" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
Do you have any possible resolution to fix this issue since I think this shouldn't happen with this Android Studio version. Thanks.
Looks like you're missing this import in the activity:
import android.support.v7.app.ActionBarActivity;
You can fix this by using ctrl + alt + o. A project rebuild might also do the trick.
I tried to refresh Gradle and it seemed to work! Maybe some instant problem with android studio and gradle synchronization!

Failure [INSTALL_FAILED_OLDER_SDK] error

I have an AVD emulator set at API 18 and my manifest is as follows:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="pushpindesigns.com.lines"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="12" android:targetSdkVersion="20"/>
<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:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".Level_1"
android:label="#string/title_activity_level_1" >
</activity>
</application>
Updated build.gradle file that includes the compilesdkversion = 18
apply plugin: 'com.android.application'
android {
compileSdkVersion 18
buildToolsVersion "20.0.0"
defaultConfig {
applicationId "pushpindesigns.com.lines"
minSdkVersion 8
targetSdkVersion 'L'
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:19.+'
}
Code above is updated and still doesn't work.................Let me know what you think
Replace android-L with something else -- 20 or 19 would be likely choices. The "L" Developer Preview will not work on anything but "L"-equipped devices and emulators.
Also, the targetSdkVersion in your build.gradle overrides that which is in your manifest. Replace the targetSdkVersion in your build.gradle to 20.

Categories

Resources