My application was working fine in Android Studio but when i added Library of google map.Showing an error.
package com.iremember.kiet;
import android.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.google.android.gms.maps.GoogleMap; //no error
import info.androidhive.slidingmenu.R;// Cannot Resolve symbol R (when added library of google map)
build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 18
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "info.androidhive.slidingmenu"
minSdkVersion 11
targetSdkVersion 17
}
buildTypes {
debug {
debuggable true
}
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile 'com.android.support:support-v4:18.0.0'
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.google.android.gms:play-services:6.5.87'
}
the error " Cannot Resolve symbol R" comming after i added google lib
Step 1(optional but helpful):
This is Java and not C or C++, stop trying to memorize the imports.
You are using Android Studio which is based off Intellij, turn on Optimize Imports: https://www.jetbrains.com/idea/help/optimizing-imports.html
Step 2:
Sync and Clean your project.
Step 3:
Without a doubt, you need to target the latest libs, get these from your SDK Manager:
apply plugin: 'com.android.application'
android {
compileSdkVersion 22 // <-- was 18
buildToolsVersion "22.0.0" // <-- was 21.1.2
defaultConfig {
applicationId "info.androidhive.slidingmenu"
minSdkVersion 11
targetSdkVersion 22 // <-- was 17
}
buildTypes {
// <-- debug is debuggable by default
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile 'com.android.support:support-v4:22.0.0' // <-- was 18
compile 'com.android.support:appcompat-v7:22.0.0' // <-- was 21.0.3
compile 'com.google.android.gms:play-services:6.5.87'
}
I have a same problem and fix it with
"sync project with Gradle files"
Related
I get the 110 errors when Gradle is building the app.
Error:(91, 23) error: package com.google.gson does not exist
Error:(94, 31) error: package com.google.gson.reflect does not exist
Error:(94, 31) error: package com.google.gson.... does not exist
...
It then tells me that this comes from the imports at my different activities, for example:
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
This is in my build.gradle which worked perfectly before the Studio update:
android {
compileSdkVersion 23
buildToolsVersion '23.0.3'
defaultConfig {
applicationId "xxxx.xxx"
minSdkVersion 16
targetSdkVersion 23
versionCode #
versionName "#.#"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
//...
compile files('C:/Users/Kaspar/StudioProjects/maakler.ee-app/libs/gson-2.7-sources.jar')
}
I also tried these versions which all gave the same result
compile fileTree(dir: 'libs', include: 'gson-2.7-sources.jar')
compile files('libs/gson-2.2.4-sources.jar')
The IDE does not give any warnings when I write the code. It only throws the error on Gradle build.
This all started after Android Studio update and I have no idea how to get this to work.
I want to use OpenCV4Android in Android Studio. I downloaded OpenCV for Android from this link:
http://opencv.org/downloads.html
But, when I try to import it, I get different errors in Camera2Renderer.java like, Cannot resolve symbol 'camera2', Cannot resolve symbol 'CameraDevice', Cannot resolve symbol 'Size', and Cannot resolve symbol 'CaptureRequest'.
I have tried both methods available here:
OpenCV in Android Studio
http://answers.opencv.org/question/14546/how-to-work-with-opencv4android-in-android-studio/
But, I get the same error.
Can anyone please tell me how to solve this error to be able to use openCV?
Thank you.
I faced the same issue while configuring OpenCV SDK with Android Studio.
I am using the latest SDK build of OpenCV : OpenCV-3.1.0-android-sdk
Please ensure that you have configured your build.gradle scripts.
Build.gradle(Module: app) -->
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "24.0.2"
defaultConfig {
applicationId "com.example.dev.opencvapp"
minSdkVersion 15
targetSdkVersion 24
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
sourceSets { main { jni.srcDirs = ['src/main/jni', 'src/main/jniLib/'] } }
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.2.1'
compile project(':openCVLibrary310')
}
Build.gradle(Module: openCVLibrary310) -->
apply plugin: 'com.android.library'
android {
compileSdkVersion 24
buildToolsVersion "19.1.0"
defaultConfig {
minSdkVersion 8
targetSdkVersion 21
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
After doing this you should be able to build the app with out any errors.
I hope I helped you!!
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import code.studio.v.R;
import code.studio.v.volley.RequestQueue;
Android studio is showing an error . Can not resolve symbol volley. I have cloned volley and added it as a module. My package name is code.studio.v
The following is my build.gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "code.studio.v"
minSdkVersion 14
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:22.0.0'
}
the following is settings.gradle file .
include ':app', ':volley'
remove module dependencies and add library dependencies..using following steps
Right Click on project - Module Setting
Go to dependencies- click plus(+) symbol
type volley and enter.. select the4thfloor dependencies
Finally sync gradle and run
If you have imported volley library as a separate module then you have to add dependency compile project(':yourVolleyModule') into your app's build.gradle. Now, Sync your gradle and i hope it will work
I am encountering problems when trying to import libraries from github in android studio projects. Very few libraries are getting imported successfully. Here is my method of importing in android studio project:
Download zip from github.
Extract the respective library.
Import module in android studio project then import the library and adding dependencies.
Here is the error tht I am encountering when I am trying to import material drawer library whose link is:https://github.com/mikepenz/MaterialDrawer
Error:No such property: GROUP for class: org.gradle.api.publication.maven.internal.ant.DefaultGroovyMavenDeployer
Is my method of importing libraries from github correct?
This is my module gradle.
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.works.vipul.materialdrawer"
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.mikepenz:materialdrawer:3.1.2#aar') {
transitive = true
}
}
You should resolve materialdrawer dependency by gradle.
Add these in your build.gradle under repositories
repositories {
mavenCentral() //add this line
}
also add this under your dependencies
compile('com.mikepenz:materialdrawer:3.1.2#aar') {
transitive = true
}
I am trying to use shinobicharts as a library for my project app. . I am getting error when I import the library classes.Please help me to sort this out.
the project goes as
app
manifest
....
....
shinobicharts-android-library
manifest
I am using following import statements to import charts and other classes from my library.
import com.shinobicontrols.charts.Chart;
import com.shinobicontrols.charts.Dock;
import com.shinobicontrols.charts.axis.XAxis;
import com.shinobicontrols.charts.axis.YAxis;
import com.shinobicontrols.charts.data.XYDataSeries;
import com.shinobicontrols.charts.data.item.XYDataSeriesItem;
import com.shinobicontrols.charts.data.item.implementation.XYDataSeriesItemImpl;
import com.shinobicontrols.charts.series.Line;
but it colors chart, dock,axis all in red and doesnot recognise them.Please help.
here is my app.gradle yes I have mentioned it.
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.example.rohit2906.myhistogram"
minSdkVersion 11
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'
compile project('libraries:shinobicharts-android-library')
}