As by documentation: https://github.com/google/google-api-java-client
To use Gradle, add the following lines to your build.gradle file:
repositories {
mavenCentral() }
dependencies {
compile 'com.google.api-client:google-api-client:1.18.0-rc' }
Done, but I get:
Error: package com.google.api.services.gmail does not exist
What could be the reason ?
You are adding Google API and trying to use Gmail API. That is why getting Error: package com.google.api.services.gmail does not exist.If you want to use Gmail API add Gmail API Client Library by adding compile 'com.google.apis:google-api-services-gmail:v1-rev29-1.20.0'
Ref: https://developers.google.com/api-client-library/java/apis/gmail/v1
com.google.api-client:google-api-client:1.20.0
on Android Studio->Project Structure->Dependencies-> "+"
you can navigate on repository declared in the gradle and choose the current version available
Related
I'm building a new project using Android Studio Canary and while setting up dependencies for jet pack compose I get this as build output:
Execution failed for task ':app:processDebugAndroidTestManifest'.
> Could not resolve all files for configuration ':app:debugAndroidTestRuntimeClasspath'.
> Could not find org.jetbrains.kotlinx:kotlinx-collections-immutable-jvm:0.3.3.
Required by:
project :app > androidx.compose.runtime:runtime:1.0.0-beta02
enter image description here
Add jcenter to the repositories of your settings.gradle file.
You can specify that it should only be used for this missing artefact.
It should look like this:
repositories {
google()
mavenCentral()
//noinspection JcenterRepositoryObsolete
jcenter {
content {
includeModule("org.jetbrains.kotlinx", "kotlinx-collections-immutable-jvm")
}
}
}
Try adding jcenter() to your repositories. It's being phased out and you'll get a warning, but at the moment it is the only solution. See this:
https://github.com/ReKotlin/ReKotlin/issues/47
and https://jfrog.com/blog/into-the-sunset-bintray-jcenter-gocenter-and-chartcenter/ : "To clarify, the JCenter repository will keep serving packages for 12 months until February 1st 2022. Only the JCenter REST API and UI will be sunsetted on May 1st 2021."
Based on this thread, I get rid of jcenter from my Jetpack Compose project by:
Modify the dependencies.kt in BuildSrc to add
object Collections {
private const val version = "0.3.4"
const val immutable = "org.jetbrains.kotlinx:kotlinx-collections-immutable-jvm:$version"
}
Modify the build.gradle(Module:) to add
implementation Libs.Collections.immutable
Replace jcenter with mavenCentral from
build.gradle(Porject:)
build.gradle(Module:)
build.gradle.kts
As a workaround, you could add explicitly to force the dependency resolution.
implementation "org.jetbrains.kotlinx:kotlinx-collections-immutable-jvm:0.3.4"
Go to this link for more info https://github.com/Kotlin/kotlinx.collections.immutable/issues/96#issuecomment-812994820
I had a spell error and caused the wrong like this, check if you had a spell error.
For my case ,I spelled 'org.jetbrains.kotlinx:kotlinx-coroutines-android' to 'org.jetbrains.kotlinx:kotlinx-coroutinesandroid' and caused the build error
I am trying to add NanoHTTPD to my Android project.
As mentioned in README.md, I added
dependencies {
runtime(
[group: 'org.nanohttpd', name: 'nanohttpd', version: '2.3.1'],
)
}
it is giving error:
Could not find method runtime() for arguments [{group=org.nanohttpd, name=nanohttpd, version=2.3.1}] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
I also tried adding
repositories {
mavenCentral()
}
mentioned elsewhere, but same error.
I tried the usual way:
implementation 'org.nanohttpd.nanohttpd:2.3.1'
it gives error:
Failed to resolve: org.nanohttpd.nanohttpd:2.3.1:
I am using Android Studio 3.2.1
There seem to be so many people happily using it in Android. What am I missing?
In your gradle file, separate group and artifact ids with a : instead of .. That is, replace
implementation 'org.nanohttpd.nanohttpd:2.3.1'
with
implementation 'org.nanohttpd:nanohttpd:2.3.1'
Based on Android docs (https://developers.google.com/games/services/android/quickstart#before_you_begin) for learning how to configure Google Play game APIs onto a sample app such as TypeANumber, I was wondering why I get the following resource errors from the BaseGameUtils library after importing the project, BasicSamples, from their GitHub's (https://github.com/playgameservices/android-basic-samples) source files:
... Based on the directory in the left panel, did I import it properly? All I did was import it straight from the directory: android-basic-samples/BasicSamples/build.gradle as stated in Step 1 of the link.
Here's my (untouched) Gradle file for the library, BaseGameUtils:
apply plugin: 'com.android.library'
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.1'
}
}
dependencies {
// Set defaults so that BaseGameUtils can be used outside of BasicSamples
if (!project.hasProperty('appcompat_library_version')) {
ext.appcompat_library_version = '20.0.+'
}
if (!project.hasProperty('support_library_version')) {
ext.support_library_version = '20.0.+'
}
if (!project.hasProperty('gms_library_version')) {
ext.gms_library_version = '8.1.0'
}
compile "com.android.support:appcompat-v7:${appcompat_library_version}"
compile "com.android.support:support-v4:${support_library_version}"
compile "com.google.android.gms:play-services-games:${gms_library_version}"
compile "com.google.android.gms:play-services-plus:${gms_library_version}"
}
android {
// Set defaults so that BaseGameUtils can be used outside of BasicSamples
if (!project.hasProperty('android_compile_version')) {
ext.android_compile_version = 23
}
if (!project.hasProperty('android_version')) {
ext.android_version = '23'
}
compileSdkVersion android_compile_version
buildToolsVersion android_version
}
... Did anyone else experience this issue before?
EDIT AS OF 4/7, 3:37PM:
So I ended up importing the project again, but within the AndroidStudioProjects directory this time (does that really make a difference?) and I actually ended up making some progress since then. However, for part 3 under step 1 within the docs:
... I ended up changing not only the package name in TypeANumber's manifest file, but also the package directory along with the classes in it as follows:
... So my question now is, am I on the right track so far in terms of the navigation directory panel at the left? :)
Yes. The package attribute in the manifest should always match the directories. Plain and simple. That's why changing it would require you to do a complete refactor. Just keep on going with the tutorial accordingly and I think you'll be good.
I'm trying to develop apps for EPSON Moverio BT-2000.
I'm new to android studio and I don't understand why I can't use some methods from a library which I have imported (correctly, I supposed).
So, I have add my lib in a folder name libs, right click on it, add as Library.
I checked in builds.gradle
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile files('libs/H725Ctrl.jar') // this lib
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:21.0.3'
}
Moreover, I can use some elements (Methods, String definitions etc..) but some not. I don't understand why and how it's possible.
If it's necessary I can publish my source code.
Have you some ideas.?
Thanks.
Franck
NB: the lib I use is depreciated by android
NB2: Exemple
Camera.Parameters params = l_pCamera.getParameters();
// I can do this and getParameters() works
List<String> Supported = params.getSupportedEpsonCameraModes();
//I can't invoke getSupportedEpsonCameraModes() or methods are in the same file
I contacted EPSON and they said it's a common problem.
So they send me a pdf which indicate how solve the problem..
It's strange..
NB the content of the PDF: sorry for the presentation but it will be helpful for someone..
1/2
Remark for using Android Studio
In case of using BT-2000 SDK with Android Studio, there may happen to have a failure during a build process. It may cause the conflict of the name between standard SDK and Epson expanded SDK. It is happened especially with “android.hardware.Camera” class.
It may resolve a failure with following action.
1. Sore H725Ctrl.jar at designated folder which is created by user like C:\Users\<user name\AndroidStudioProjects\<application name>\app\libs
2. Set change of gradle by selecting “Sync Project with Gradle Files” button which is located upper of Android Studio screen.
3. Open “build.gradle” for specified project with specified application name by selecting left side button on Android Studio screen. Then edit with following contents.
allprojects { repositories { jcenter() } gradle.projectsEvaluated { tasks.withType(JavaCompile) { options.compilerArgs.add('-Xbootclasspath/p:C:/Users/<user name>/AndroidStudioProjects/<application name>/app/libs/H725Ctrl.jar') } } }
4. Execute “Clean Project” then “Make Project” in Android Studio Build menu.
5. If error occurs in Make project process, end Android Studio and restart it.
2/2
6. There may still remain several name conflicts with Android standard API like “getSupportedEpsonCameraModes()”. Ignore and “run application” to set it into target BT-2000.
[ Caution ]
It works temporally with following action;
Open
C:\Users\<user name>\AndroidStudioProjects\<application name>\app\app.iml
Move line of
<orderEntry type="library" exported="" name="H725Ctrl" level="project" />
to upper line of
<orderEntry type="jdk" jdkName="Android API 23 Platform" jdkType="Android SDK" />
This will help H725Ctrl.jar to be higher priority, however performing rebuild function will affect to reset name conflict issue.
Object which is performed build function already works well.
It's weird. Epson tries to override some Android specific classes in their jar:
android.hardware.Camera
android.hardware.Camera.Parameters
These classes are part of the Android SDK (http://developer.android.com/reference/android/hardware/Camera.html). I do not know Epson would like to achieve, if they bundle the classes with their SDK. Maybe you could change the packagename in the H725Ctrl.jar to something like
com.epson.hardware
with JarJar (https://github.com/shevek/jarjar)?
Add the following code to your build.gradle file. The problem could be that the Moverio Camera class uses the same namespace as the Android sdk and there is an ordering issue
allprojects {
repositories {
jcenter()
}
gradle.projectsEvaluated {
tasks.withType(JavaCompile) {
options.compilerArgs.add('-Xbootclasspath/p:C:/Source/EPSONProBT-2000ServiceMaintenance/app/libs/H725Ctrl.jar')
}
}
}
I am trying to use Quickblox's sample chat application.
http://quickblox.com/developers/Android_XMPP_Chat_Sample
But I am getting this error "The import vc908 cannot be resolved"
At this line :
import vc908.stickerfactory.StickersManager;
I have used these libs :
- quickblox-android-sdk-chat-2.2.6.jar
- quickblox-android-sdk-core-2.2.6.jar
Also Added these :
- android-support-v7-appcompat
- google-play-services_lib
- pull-to-refresh
StickersManager is a part of StickerPipe library. To use stickers functionality, you must include dependency to this library
repositories {
maven { url 'http://maven.stickerpipe.com/artifactory/stickerfactory' }
}
dependencies {
compile('vc908.stickers:stickerfactory:0.2.2#aar') {
transitive = true;
}
}
This integration described at Stickers section of documentation
You need use android studio to build project. If you use Eclipse, try to migrate with this tutorial
UPDATE
Eclipse users now can follow this instructions to add StickerPipe library
And another sample with StickerPipe library