I don't understand how to add this library (https://github.com/owncloud/android-library) to my project in Android Studio.
I have tried to import this library as a module but found error while importing:
Error: Module name is not valid
So I tried to find a solution and here it is:
1. Download library from Github here.
2. Unzip library.
3. Start Android Studio.
4. Follow to File -> New -> Import Module .
5. Go to the path where your extracted library is located and select it.
6. Uncheck other modules and add 'androidlibrarymaster' described in below picture.
7. Add Gradle dependency and Its Done!
compile project(':androidlibrarymaster');
Maybe try jitpack website to import this project with build.gradle file.
You have to add this snippet to your build.gradle file :
repositories {
// ...
maven { url "https://jitpack.io" }
}
And this statement to your dependencies :
compile 'com.github.owncloud:android-library:oc-android-library-0.9.7'
Related
While learning android studio from udacity they asked me to download a project; I did so but while I was importing it to android studio I got an error message:
The project uses Gradle 2.10 which is incompatible with Android Studio 2020.3.
Why did I get this error?
If you did not figure this out yet, I am just starting the same project too. I changed the classpath like above. I then found a website to use the latest version of gradle and the plugin. It says "You can specify the Gradle version in either the File > Project Structure > Project menu in Android Studio, or by editing the Gradle distribution reference in the gradle/wrapper/gradle-wrapper.properties file." I did the first one.
Then, I got errors for both build.gradle files in the project and app version. I get this error: Could not find com.android.tools.build:gradle:7.0.3
If you get this error, click the link "Add google Maven repository and sync project". Then you have to click "Do refactor".
Now you come across another error in one of the build.grade files. This stackoverflow link will tell you: Gradle - Error Could not find method implementation() for arguments [com.android.support:appcompat-v7:26.0.0]
Finally, replace testCompile with testImplementation and then you should get BUILD SUCCESSFUL.
The project's Gradle version you're trying to clone is outdated. Change it based on your android studio version.
on your build.gradle(Project) change the version and sync
classpath "com.android.tools.build:gradle:4.1.2"
Got the solution :)
In gradle-wrapper.properties:
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-all.zip
In build.gradle project level:
buildscript {
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.0.4'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
In build.gradle module level:
Replace all "compile" with "Implementation" and do other suggested version updated and you are done here :)
Hope this works for you, if yes just press that up button :)
If not getting any solution, the best you can do is copy the "app" folder of your project(using file explorer) and paste it in a newly created project(should be of same name as of your project), in that way you'll get already synced gradle and newly created version of your app.
Because, every important thing in your project is present in its app folder and when you create a new project with same name and copy app folder from your older version of your project, you will have a newer version of your project with all same resources.
Note: You can't move through branches and other commits
I saw this issue several times with Android studio. Below trick worked me the best.
Android Studio suggests to upgrade to newer version, please upgrade it and let it sync
Mostly you would see error message again
Now, Go to File -> Invalidate Caches/Restart
It should work now
If it shows same error then I don't know what to do.
If it shows different error then repeat from step 1 to 3 for new error.
Hope, it helps some..
This library contains 1 bug.
It was fixed here: https://github.com/heinrichreimer/material-intro/pull/287
What is the simplest way to implement this fixed version of the library to my Android studio project? I'm new to using libraries from GitHub, I'd appreciate some help on this.
I'm currently using this: implementation 'com.heinrichreimersoftware:material-intro:2.0.0'
You have several options:
Wait for/Ask the owner to release a new version and use it.
Fork the project and release one version of your own.
Download the library and import it in your project as a dependency.
I'll explain here the third option:
Go to https://github.com/heinrichreimer/material-intro.
Click the Code button and Download ZIP.
Open the ZIP file and open the material-intro-master folder.
Rename the library folder to material-intro-library.
Open your project in Android Studio.
Go to File > New > Import module... and select the material-intro-library folder.
Finally, open your build.gradle file and replace implementation 'com.heinrichreimersoftware:material-intro:2.0.0' with implementation project(path: ':material-intro-library')
You could use JitPack.io which acts as a repository for libraries just like maven and also to compile any Android or Java library using Gradle on GitHub at the required commit (found in the the pull request) and use the compiled library in your project in two steps. No need for waiting, cloning, importing or even compiling on your local PC, all done and covered by JitPack.io. Here are the the steps (retrieved from website):
Step 1. Add the JitPack repository to your build file
Add it in your root build.gradle at the end of repositories:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
Step 2. Add the dependency
dependencies {
implementation 'com.github.heinrichreimer:material-intro:b35d1c9d65'
}
You can clone material-intro library to your pc. Place the material-intro/lib folder to your project root directory path.
add include ':library' to your setings.gradl
add implementation project(':library') to your app-level build.gradle
You could use JitPack.io which acts as a repository for libraries just like maven and also to compile any Android or Java library using Gradle on GitHub at the required commit.
Step 1. Add the JitPack repository to your build file
Step 2. Add the dependency
enter image description here
I was following the tutorial on the Google Cloud platform, but I do not get it at all.
enter image description here
So I got a bulid file that did not exist, and I thought I could use the build / ilbs / name-jar file, but it did not.
When I ran build I saw a lot of downloads. Maybe download the api.
I created a different project and used a jar file, but I read the error "The import com.google can not be resolved" in every import com.google section
enter image description here
I am not an English citizen. This article is written in Google Translator.
Sorry for the poor English.
I could not find a good example in my language.
To have a complete set of configuration in a eclipse project you need the following configuration in the build.gradle file (see section "Installation is easy" in this link):
repositories {
mavenCentral()
}
dependencies {
compile 'com.google.api-client:google-api-client:1.23.0'
}
You can add the Speech API dependency:
compile 'com.google.cloud:google-cloud-speech:0.53.0-alpha'
In the images you attached, there are mixing eclipse projects: ttt and fairy. In the project fairy the build.gradle doesn't seem exist and this is a cause for the unknown com.google package.
Add the build.gradle or recreate the Gradle Project, then click Refresh Gradle Project.
I am trying to import common-math library to my Android Studio project. I placed the file commons-math3-3.6.1.jar file in libs folder and in the gradle file I have this line:
compile 'commons-math3-3.6.1.jar'
But I get this error: `
Error:(32, 0) Supplied String module notation
'commons-math3-3.6.1.jar' is invalid. Example notations:
'org.gradle:gradle-core:2.2',
'org.mockito:mockito-core:1.9.5:javadoc'.
Can anyone tell me what I have to do?
Is there a reason you need to use the jar file? You can get the file directly from Maven repository using something like this:
compile 'org.apache.commons:commons-math3:3.6.1'
Available on both JCenter and MavenCentral.
in Android view open Gradle Scripts - build.gradle and add this to dependencies:
implementation 'org.apache.commons:commons-math3:3.6.1'
You can also check their websites if newer version isn't available list of latest versions
I've got a custom android project in IntelliJ IDEA 15. We are using the default Android webview now, but want to replace it with crosswalks XWalkView.
I've read and tried a lot of options, but can't get the XWalkView to resolve. What have I tried?
Following this tutorial: https://crosswalk-project.org/documentation/android/embedding_crosswalk.html
downloading the source crosswalk-17.46.448.10.zip
importing xwalk_core_library as a new library project in IntelliJ
build the project
add this project as a library dependency in my project
Try to add the maven dependency to (https://download.01.org/crosswalk/releases/crosswalk/android/maven2/org/xwalk/xwalk_core_library/17.46.448.10/) to the existing android project
In your build.gradle file, add this:
repositories {
maven {
url 'https://download.01.org/crosswalk/releases/crosswalk/android/maven2'
}
}
And to the dependencies,
dependencies {
compile 'org.xwalk:xwalk_core_library:10.39.235.15'
}
Bingo!