I am new to Android Studio, but I currently get this error:
error: package com.google.android.gms.maps does not exist
Now, if I in
project/module/build.gradle I do this
apply plugin: 'android'
android {
compileSdkVersion 19
buildToolsVersion '19.0.1'
defaultConfig {
minSdkVersion 8
targetSdkVersion 17
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
} }
dependencies {
compile 'com.android.support:appcompat-v7:+'
compile files('src/main/libs/google-play-services.jar') }
I currently get this error:
Could not find method
android.webkit.WebView.setWebContentsDebuggingEnabled
And earlier I got this
Could not find class 'com.google.android.gms.maps.SupportMapFragment'
Whatt is the correct thing to do here / how do I solve above errors?
For reference: I orignally manually converted this project form a broken Eclipse project - sadly, for both Eclipse builds and Android Studio builds, it is the map/library thing that I seem unable o solve. The app is otherwise still working as it was before.
Replace
compile files('src/main/libs/google-play-services.jar')
with
compile 'com.google.android.gms:play-services:4.0.30'
or use newer version if you want.
You need to have Google Play Services downloaded in SDK.
Related
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 am using Android studio 1.5. and at when i click run i receive
unable to determine package name
i checked the manifest file and it is as shown in the image below...but i do not know why the activities are marked with red even the app name and the icon
as well.
please let me know how to fix this
build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.example.com.bt_11"
minSdkVersion 21
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'
}
I followed the same steps as user2121 and eventually tried downgrading to Android Studio 1.4.1. Unlike user2121, I still got an error, however it was different than when on 1.5.1.
AndroidManifest.xml file not found
Upon searching for this new error, I found this StackOverflow answer which solved the problem for me on 1.5.1 as well as 1.4.1.
A few months ago, I decided to take some custom methods and classes that I was using in more than one project and put them in their own project called "FarmSoftLibraries" that all of my projects could reference. This allowed me to make changes or additions once. It has been working very well up until yesterday (8/23/2015) when i started getting an odd error on a new method that Gradle could not find. However Android Studio had no problem finding this method. See: https://stackoverflow.com/questions/32167734/cannot-find-symbol-method-for-custom-static-class-method. However older, non-new methods continued to work.
Today the entire build system stopped working and I'm getting hundreds of Gradle errors saying that packages and methods in FarmSoftLibraries do not exist. Still, Android Studio has no problem locating these.
D:\Scott\Android\Studio\SpellingTutor\app\src\main\java\com\farmsoft\spellingtutor\Learn.java:12: error: package com.farmsoft.farmsoftlibraries.Utils does not exist
import com.farmsoft.farmsoftlibraries.Utils.FarmUtils;
^
D:\Scott\Android\Studio\SpellingTutor\app\src\main\java\com\farmsoft\spellingtutor\Learn.java:14: error: package com.farmsoft.farmsoftlibraries.Utils does not exist
import com.farmsoft.farmsoftlibraries.Utils.Logg;
^
D:\Scott\Android\Studio\SpellingTutor\app\src\main\java\com\farmsoft\spellingtutor\utils\KeyValueDB.java:6: error: package com.farmsoft.farmsoftlibraries.Utils does not exist
import com.farmsoft.farmsoftlibraries.Utils.CsvUtil;
etc. etc. etc...
I want to stress that I've changed NOTHING in the gradle files. I have been upgrading Android Studio on the Canary path - I'm on 1.4 Preview 3 now. When this issue began I was on 1.4 Preview 2. I have no idea if this is related to this version of Studio.
My gradle scripts:
project settings.gradle:
include ':app'
include ':farmsoftlibs'
project(':farmsoftlibs').projectDir = new File('../FarmSoftLibraries/app')
app build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.farmsoft.spellingtutor"
minSdkVersion 15
targetSdkVersion 22
versionCode 28
versionName "1.15"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
minifyEnabled false
applicationIdSuffix '.debug'
versionNameSuffix '.debug'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.google.android.gms:play-services-gcm:7.8.0'
compile project(':farmsoftlibs')
}
farmsoftlibs build.gradle:
apply plugin: 'com.android.library'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
minSdkVersion 15
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile files('libs/gson-2.3.1.jar')
compile 'com.google.android.gms:play-services-vision:7.8.0'
}
I do want to admit I pretty much am ignorant about gradle - I follow the instructions for how to set it up in Android Studio, but I really don't know what I'm doing and have gotten lost in the Gradle documentation I tried to read. So this is incredibly frustrating and more so knowing that this is probably due to some stupid mistake I've made out of ignorance.
EDIT:
This seems to have something to do with ProGuard - if I change the library's release settings to say minifyEnabled false, then the error goes away... for now. I'd like to know why.
I am currently trying to make Facebook SDK cooperate with my Android Studio. I've been following their step-by-step guide: https://developers.facebook.com/docs/android/getting-started (so far so good), but I am currently hitting a wall.
While trying to sync my project, I get following error: Failed to find Build Tools 4.0.1.
At this point I did the obvious, clicked the "Install Build" link, which gave the me installer window. I accept the agreement, but when I get to the installing components tab, I get this error: http://i.imgur.com/1IJS07f.png
I've trying messing around with some numbers to see if it was a version error, but no luck.
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.0"
defaultConfig {
applicationId "com.notresponding.fbtest"
minSdkVersion 9
targetSdkVersion 21
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'])
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.facebook.android:facebook-android-sdk:4.0.1'
}
Seeking a solution, thank you :)
EDIT: Adding build.gradle
I am using Android Studio and created a new project, which created the standard "Hello world" mock.
My gradle.build file has the following contents:
apply plugin: 'com.android.application'
android {
compileSdkVersion 20
buildToolsVersion "20.0.0"
defaultConfig {
applicationId "com.example.whatever.blabla"
minSdkVersion 19
targetSdkVersion 20
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
}
Even though I did not change anything, Gradle still fails when trying to build it with the error:
Failed to complete Gradle execution.
Cause:
A fatal exception has occurred. Program will exit.
First of all, is there any way of getting extra info about the problem? And secondly, why is this happening since I only created a standard project?
I had the same problem and could fix it by following solution provided in the below link -
https://code.google.com/p/android/issues/detail?id=67946
Though I am not sure how setting the maxheapsize has fixed the issue.