Cannot resolve dependencies in sample Google VR Project - java

I cloned the project from here git clone https://github.com/googlevr/gvr-android-sdk.git
I imported the gvr-android-sdk project into Android Studio:
Opening the buid.gradle for the samples-sdk-treasurehunt project I see the following dependencies:
dependencies {
compile 'com.google.vr:sdk-audio:1.60.1'
compile 'com.google.vr:sdk-base:1.60.1'
}
See image here:
What am I missing?

If you take a look at https://bintray.com/google/googlevr/sdk-audio
It shows that version 1.60.1 hasn't been pushed to the repository yet. Try setting the versions to 1.60.0 (the latest pushed version)
edit: you may have imported the wrong folder, you need to import the folder that you cloned the repository to (as you need to project-level build.gradle), instead of import gvr-treasurehunt import gvr-android-sdk

Subscribe to the recently create issue at https://github.com/googlevr/gvr-android-sdk/issues/431 where I've added an initial solution (change ALL dependency references to 1.60.1 to 1.60.0, not just for the sample you're building.

Related

How to import & use github repos in Android Studio

I've spent hours trying to import/use a custom github repo for an android app and am having no luck. I'm new to Android Studio but can't seem to import the repo such that I can use its methods. I've tried a lot of recommendations from here and the wider web without success. Probably because the posts I have come across are 5+ years old...
Have tried adding the following to to build.gradle (:app), but I get an error "Failed to resolve: com.github.pkleczko:CustomGauge:1.0.4":
implementation 'com.github.pkleczko:CustomGauge:1.0.4'
Have tried adding the the following to the above, but this gives me the error "Build was configured to prefer settings repositories over project repositories but repository 'MavenRepo' was added by build file 'app\build.gradle'":
repositories {
mavenCentral()
}
Have tried using New -> Import Module and New -> Project from Version Control per this, but these just opened the repo in a new window.
Having CustomGuage as a dependency for my app module didn't seem to do anything either.
It shouldn't be this hard, should it?! Please help, what am I doing wrong?! Do I need to import the project and then refactor it for my needs rather than using it as a 'library'? Do I need to add an import statement to my java file?
Thank you!
This is an old project. You can see his warehouse introduction. He uploaded it in jcenter. Of course, mavenCentral will not.
this is repository -> pkleczko/CustomGauge

Cannot resolve FirebaseFirestore Android

I followed the official firebase android guide, but whenever I try to instantiate the FirebaseFirestore, I get a "cannot resolve symbol" error. The issue is as shown below:
Before this is marked as a duplicate, I have been searching for a solution to this issue for hours now. Nothing I found online works. Below is my gradle config:
app:
root:
Is there any idea what I am doing wrong? I have tried various different plugin versions for fireStore and firebase app but nothing seems to work
it all hints for, that the artifact had not yet been downloaded...
check if Gradle isn't in offline mode; and sync or build the project once.
alternatively, run ./gradlew clean assembleDebug from a terminal.
repository mavenCentral() is also rather relevant than mavenLocal().
while the repository for these artifacts should be the google() one.
another known issue is, that one may have to prefer IPv4, in the gradle.properties file:
org.gradle.jvmargs=-Djava.net.preferIPv4Stack=true
Try adding this to your gradle
The FirestoreRecyclerAdapter class is part of the FirebaseUI Library but not the core Firestore SDK
implementation 'com.firebaseui:firebase-ui-firestore:4.3.1'
Try close your project and reimport it again
Looks like you have missed import statement
import com.google.firebase.firestore.FirebaseFirestore;
Try this:-
In Android Studio, click on File.
Then click Sync Project with Gradle Files.
I Recently Had that Error and this are the steps that I tried, I am not pretty sure which one of these did the trick but the error was solved and I was able to utilize fireStore. These are not in any Order I just randomly continued doing these.
I hope these helps.
Check for these
1. Have You Installed Google Play Services and Google Repository.
Check for the Updated Version and install it if available.
2. Try to Match All the Versions in the gradle config: app ... for eg,
implementation 'com.google.firebase:firebase-core:16.0.3'
implementation 'com.google.firebase:firebase-firestore:16.0.3'
Sync Those Files for Quite few times
3. Clear Caches and Restart the Android Studio IDE
Step 1:- Go to File Menu > Invalidate Caches/Restart..
Step 2:-
Click on Invalidate and Restart on the Window that Appears
This
will restart the project and rebuild it, Stay calm as this can take
quite a time.
After Following These Steps all my Error were Solved and I was able to instantiate the FirebaseFirestore.
project build.gradle
allprojects {
repositories {
google()
jcenter()
maven { url 'https://jitpack.io' }
}}
I recently faced this problem. There is a simple solution.
Add this to your app Gradle:
implementation 'com.google.android.gms:play-services-base:15.0.1'
implementation 'com.firebaseui:firebase-ui-firestore:4.3.1'
Import the following statement:
import com.google.firebase.firestore.FirebaseFirestore;
Thank me later :)

Using Java & Gradle to build a maven project from github

I need help with the following problem:
Right now, I want to use my Java Gradle Project to build this github-project:
https://github.com/PaperMC/Paper but the project but it's a maven project.
I found a plugin for adding github projects as dependencies but it fails here.
An alternative would be to use this jenkins here: https://ci.destroystokyo.com/job/Paper/
However here I'm struggling to make my gradle always use the newest build without having to reasign the chaning version numbers by hand.
Can someone help me out because I have no idea what and how to add to the build.gradle.
Thanks in advance!
Edit:
I found the Maven-Syntax for the correct pull here:
https://paper.readthedocs.io/en/paper-1.11/developers/#plugin-developers
But when I try to convert the information to Gradle I still fail when I try to leave out the version so that Gradle would fetch the latest one. Can someone provide a valid snipped for this? I have never done this before.
According to this guy, you can use a fake ivy repository.
As https://ci.destroystokyo.com/job/Paper/lastSuccessfulBuild/artifact/paperclip.jar points on the latest build, just set up your repository like this :
repositories {
ivy {
url "https://ci.destroystokyo.com/job/Paper/lastSuccessfulBuild/artifact/"
layout 'pattern' , {
ivy '[module]-ivy.xml'
artifact '[module](.[ext])'
}
}
}
And then, use the dependency (the group is not relevant here)
dependencies {
compile 'anything:paperclip'
}
It will get the right file
$ gradle build
Download https://ci.destroystokyo.com/job/Paper/lastSuccessfulBuild/artifact/paperclip.jar
...

Get latest snapshot version from Maven Repository in Gradle

I have project which using Gradle to publish our SNAPSHOT artifact's to remote Maven Repository.
When I publish to Maven, time stamp and build number is getting appended to Jar name. And I am trying to download the latest version ie myjar-1.6.0-20170926.190543-10.jar from one of other project. I am not able to download until unless, I remove it from my .gradle or restart my work space.
myjar-1.6.0-20170926.162756-7.jar
myjar-1.6.0-20170926.162756-7.jar.md5
myjar-1.6.0-20170926.162756-7.jar.sha1
myjar-1.6.0-20170926.162756-7.pom
myjar-1.6.0-20170926.162756-7.pom.md5
myjar-1.6.0-20170926.162756-7.pom.sha1
myjar-1.6.0-20170926.182639-8.jar
myjar-1.6.0-20170926.182639-8.jar.md5
myjar-1.6.0-20170926.182639-8.jar.sha1
myjar-1.6.0-20170926.182639-8.pom
myjar-1.6.0-20170926.182639-8.pom.md5
myjar-1.6.0-20170926.182639-8.pom.sha1
myjar-1.6.0-20170926.182748-9.jar
myjar-1.6.0-20170926.182748-9.jar.md5
myjar-1.6.0-20170926.182748-9.jar.sha1
myjar-1.6.0-20170926.182748-9.pom
myjar-1.6.0-20170926.182748-9.pom.md5
myjar-1.6.0-20170926.182748-9.pom.sha1
myjar-1.6.0-20170926.190543-10.jar
myjar-1.6.0-20170926.190543-10.jar.md5
myjar-1.6.0-20170926.190543-10.jar.sha1
myjar-1.6.0-20170926.190543-10.pom
myjar-1.6.0-20170926.190543-10.pom.md5
myjar-1.6.0-20170926.190543-10.pom.sha1
The dependency project has below
configurations.all {
resolutionStrategy.cacheDynamicVersionsFor 0, 'seconds'
resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
}
compile ( group: "com.test", name:"myjar", version: "1.6.0-SNAPSHOT", changing: true );
Also tried with
compile ( "com.test:myjar:latest.integration);
But nothing working out. Let me know how to fix this?
You can run the local build with --refresh-dependencies. See the answers to this question How can I force gradle to redownload dependencies? for more information.
I encounter the same situation as you.
Develop environment: Android Studio 4.0
Building tools: gradle 3.6
Computer: Mac
I'm at app end, while I am using a jar from server end, the jar is included by adding maven repo and adding project dependency in build.gradle, like this:
buildscript {
repositories {
mavenLocal()
maven { url 'http://maven.xxx.com/xxx/xxx/‘ }
}}
dependencies {
...
implementation ‘project_group_id:artifact_id:latest.integration’
}
Instead of using ./gradlew build --refresh-dependencies to clear cache, I directly went to the cache folder /Users/your_user_name/.gradle/caches/modules-2/files-2.1 and delete the local jar in order to download updated one.
But still failed...
Finally we found the cause is weird:
we included several maven repo, one repo has the same project as the one we need, but it has only one version for each version code.It is in front of the maven repo from which we can download newest jar, therefore it blocked the update of the newest version.
We exchange the sequence of these two repo, and the problem disappear.
In my case, it's nothing to do with the maven config or the cache, it is due to repo included in gradle. Further reason still need to dig.
Hope can help the ones who meet the same problem.

custom library from maven not able to download for different version

I have a custom library uploaded to bintray maven with version 1.0.0
To download it for any project i have used the following code
repositories {
maven {
url "http://dl.bintray.com/<org or user name>/<repo-name>"
}
}
And inside my app level build.gradle i have added the dependency
dependencies {
.....
compile 'my-group-id:artifactId:versionId'
.....
}
Recently i upgraded the versionId to 1.0.2 and it doesn't compile. For version 1.0.0 it compiles fine.
Heres the error i get
Error: Could not find sdk.jar (com.appunfold:sdk:1.0.2).
Searched in the following locations:
http://dl.bintray.com/appunfold/android/com/appunfold/sdk/1.0.2/sdk-1.0.2.jar
I checked the files inside 1.0.2. It contains sdk-1.0.2.aar (not sdk-1.0.2.jar)and compared it with the files inside 1.0.0. It contains the same with the version 1.0.0 i,e sdk-1.0.0.aar.
I couldn't find the reason why it is not able to download for a different version. Anybody faced the same issue?
Found the solution after a deep few hours of research.
I think Android Studio by default searches for jar files. But since in my case only aar files are available i had to specify one more parameter (#aar) while compiling the dependency.
It looks like this
dependencies {
.....
compile 'my-group-id:artifactId:versionId:#aar'
.....
}

Categories

Resources