It's my code sample. When I firstly build my code, it results in so-called dex error. I added multiDexEnabled property to my gradle setting, but it results in java heap memory overflow. I increased its max size, and finally got builded. However, another error occurred...... what is the problem? android adk version?
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "24.0.2"
defaultConfig {
applicationId "belobster.earthquakealert"
minSdkVersion 14
targetSdkVersion 24
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions {
javaMaxHeapSize "2g"
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.google.android.gms:play-services:9.6.1'
}
emulator image.
Check whether play services is available on the emulator, you should consider using physical device for these kind of testing purposes since maps require location services quite often.
download gapps-lp-20141109-signed and install in genymotion
If you want to test it into Genymotion only then , Genymotion provide support for play service
So please check it. It's work for me.
Thank you.
Related
I want to run my app, which uses transitions on an android device with Jelly Bean 4.2.2, API 17. In the build.gradle:app targetSdkVerion is set to 24, minSdkVersion to 16.
When launching the app on my device I get the error Could not find class android.transition.Transition
On Android Developers theres a package called android.support.transition mentioned, but I don't know how to use it, when I insert it in my build.gradle I get an error, "Could not find com.android.support:transitions:24.1.1.
Do I need to change the values, and if so, how?
My build.gradle (app)
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "24.0.1"
defaultConfig {
applicationId "user.example"
minSdkVersion 16
targetSdkVersion 24
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:24.1.1'
compile 'com.android.support:design:24.1.1'
compile 'com.android.support:transition:24.1.1'
}
You need to download or update support library from SDK Manager. This is link from Android Developer website :
Setup Support Library
Then you can use the support transition library. Note that if you want to use the TransitionManager class from this support library, be sure to import the support library version ('android.support.transition.TransitionManager')
Need a bit of help here!, I have built an application with min api level 15 and target api level 23, now the problem is when i deploy the app on to a phone with api 19 or any phone less than api 22 the app crashes on start up. Please help me out guys? I tried adding permissions in the manifest file but in the end it would be overriden by the build.gradle(Module App) file. I am confused with it and trying to resolve it. Please help me out!
Thanks in Advance!
plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.something.sampleapp"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
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.mcxiaoke.volley:library-aar:1.0.0'
compile 'com.google.android.gms:play-services:9.0.1'
}
i had the same problem that is caused by Firebase when tested under API 23.
check out the link :
Getting Exception java.lang.NoClassDefFoundError: com.google.firebase.FirebaseOptions after updating to the new firebase
Try this; I hope it helps you:
Go to Settings
Click on build, execution and deployment
After that you find instant run click on that
Uncheck the enable instant run to hot swap code/resource
check if you installed SDK 19 in your android studio, i had the same issue with api 17 and its solved after installing the SDK
I am using Android studio and i want to use Marshmallow API and AppCompatActivity. When I created a new project the build.gradle contained the below lines but I receive error at R class which says not a symbol.
Please let me know how to correct the build.gradle to get the App work.
gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.example.com.myapplication"
minSdkVersion 19
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'])
compile 'com.android.support:appcompat-v7:23.0.1'
}
Click on Build->Clean Project and that will perform a gradle clean
Update your Android SDK Manager Install all component of Android 6.0 (API 23)
R file can be erased due to many reasons, try rebuilding your project(which is the most common issue) and other issues may include any syntax error or inappropriate file permissions in work space, the exact error report can help address the issue better.
I'm trying to implement Google Maps in my app, I've already requested the API and already properly put in the API key at the right place, and the map seem to load up without any problems, but sections of codes are highlighted in red. Would appreciate any help! Oh, and I am using android studio.
Also, I've tried it on a test app before this, and it worked fine iirc. Then I deleted that project and all the keys at google's developer console and started new for my main project and this happens. If this info helps in any way.
Here's a screenshot of the code error :
Here's build.gradle if it helps :
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "bossharriscorporation.sendmethere"
minSdkVersion 15
targetSdkVersion 22
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:22.2.0'
compile 'com.google.android.gms:play-services:7.8.0'
}
I found the answer. I was careless. Apparently the application name cannot have an exclamation mark in it. I didn't know before. I shall learn more to better myself.
I am trying to test out an Android TV app on my TV. It works in the emulator and I am using Android Studio 0.8.14.
My build.gradle file is:
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.1"
defaultConfig {
applicationId "kgibilterra.com.tvgame"
minSdkVersion 21
targetSdkVersion 21
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:recyclerview-v7:21.0.0'
compile 'com.android.support:leanback-v17:21.0.0'
compile 'com.android.support:appcompat-v7:21.0.0'
compile 'com.squareup.picasso:picasso:2.3.2'
}
I have everything installed in the SDK Manager and in AndroidManifest.xml I have
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="21"/>
Has anyone else figured this out with AndroidTV specifically?
INSTALL_FAILED_OLDER_SDK you are facing means device you are trying to install your app on, is running lower version than required in your Manifest's android:minSdkVersion. I am almost sure your app is not requiring Lollipop to run, so you need to edit your Manifest and set these values correctly.
See docs: http://developer.android.com/guide/topics/manifest/uses-sdk-element.html
change the minSdkVersion value to 19. The issue will solved.