Gradle sync failing after attempting to import Parse project - java

I was following the Parse quickstart guide, downloaded their sample project, and opened it. There was a problem there, and now my previously working, non-Parse project is having trouble with Gradle. I'm getting the following problem every time I try to sync:
Error:(4, 0) Cannot get property 'compileSdkVersion' on extra properties extension as it does not exist
I've been researching this online, and nothing I can find can even begin to help me. Any thoughts, at least on where to start? Thanks in advance!
EDIT: By request, here's my Gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "jpb9rq.cs2110.virginia.edu.chinupdemo"
minSdkVersion 15
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:21.0.3'
}

Related

How do I modify a resource file of an external library included in my project?

https://github.com/Gericop/Android-Support-Preference-V7-Fix/blob/master/preference-v7-simplemenu/src/main/res/layout/preference_simplemenu.xml
I have the Android preference-v7 fix library included into my Android app project and I'd like to change some things inside this xml. To be more specific, I want to align the menu and the summary textview to the right. How can I make the app use my xml file instead of the one from the library?
My gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "app.test.testapp"
minSdkVersion 19
targetSdkVersion 27
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
buildToolsVersion '27.0.3'
productFlavors {
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:27.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:design:27.1.0'
implementation 'com.takisoft.fix:preference-v7-simplemenu:+'
compile 'com.takisoft.fix:preference-v7:27.1.0.0'
}
If you aren't pulling any new copies of the lib then you could manually replace the file in the jar once and just use that edited jar.
If you are pulling the lib during your build then you could programatically replace the file with your own file during the build process.
Perhaps show us your build process? Do you need this file to be up-to-date with a version on a repo (except for your changes)?

Android Studio does not recognise my imported libraries (No Adminstrator, using a proxy at work)

I am trying to add the library
"com.android.support:support-v4:24.0.0" and "com.android.support:appcompat-v7:24.0.0" in Android Studio and have done everything the tutorials asked me to do, yet it doesnt work.
These are my dependencies after i added them:
http://www.pic-upload.de/view-31027299/Dependencies.jpg.html
This is my build.gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "24.0.0"
defaultConfig {
applicationId "de.programmierenlernenhq.aktiehq.app"
minSdkVersion 10
targetSdkVersion 24
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:support-v4:24.0.0'
compile 'com.android.support:appcompat-v7:24.0.0'
}
This is my SDK Manager:
http://www.pic-upload.de/view-31027308/SDKManager.png.html
I did all of this, yet I get the Error "Unused import statement" at the line "import android.support.v7.app.ActionBarActivity;" and "import android.support.v4.app.Fragment;".
I am doing this at work without administrative rights and behind a proxy. I am having the feeling that the problem might be there. Hopefully you know more about this. Thank you in advance!
There is no com.android.support:support-v4:24.0.0 yet.
Please use: com.android.support:support-v4:23.4.0
If You are unsure of the library version, you can always check it here

Not able to add dependecy in gradle(Android Studio)

I am trying to add this dependency https://github.com/hoang8f/android-flat-button in to my android studio project and I am getting
Error:(26, 13) Failed to resolve: info.hoang8f:fbutton:1.0.5
I am able to add google play services dependency easily without any problems.
Below is my build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.example.planner"
minSdkVersion 15
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:22.2.1'
compile 'com.google.android.gms:play-services:7.5.0'
compile 'info.hoang8f:fbutton:1.0.5'
}
Solutions tried:- 1.)Gradle is working in online mode not offline.
2.)Cleaned and builded/rebuilded the project.
3.) Changed to
repositories {
mavenCentral()
}
in my root gradle file
4.) Tools->android->Sync Project with gradle files
Still no luck in making it work.
P.S.:- Not that it effects the questions, I faced the same problem while trying to add parse sdk via gradle, so I added the jar file independently.
add
repositories {
mavenCentral()
}
include android tag
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.example.planner"
minSdkVersion 15
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
repositories {
mavenCentral()
}}
Please try this. Add fbutton-1.0.5.aar file into your lib folder.
repositories {
flatDir {
dirs 'libs'
}
}
Add aar file into dependencies.
dependencies {
compile(name:'ARFile', ext:'aar')
}
Did you noticed how looks like build.gradle of a demo project?
https://github.com/hoang8f/android-flat-button/blob/master/demo/build.gradle
apply plugin: 'android'
android {
compileSdkVersion 19
buildToolsVersion '19.1.0'
defaultConfig {
minSdkVersion 9
targetSdkVersion 19
versionCode 2
versionName "1.1"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
} }
dependencies {
compile 'com.android.support:appcompat-v7:19.+'
compile 'com.larswerkman:HoloColorPicker:1.4'
compile fileTree(dir: 'libs', include: ['*.jar']) // compile project(':library')
compile 'info.hoang8f:fbutton:1.0.5'
}
Check if you're not missing something in your Gradle file or you put something wrong
EDIT: I've put whole your build.gradle file into my new project and it's work fine.
If rebuilding not help, create a new clean project and put this build.gradle. Tell me is it works with new project.
EDIT2:
In your project you have two build.gradle change the second one to
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
classpath 'com.google.gms:google-services:1.5.0-beta2'
}
}
allprojects {
repositories {
jcenter()
}
}
I had the same problem.
Invalidate cache and restart your android studio. Then sync gradle.
I cloned the project and used "demo" module to test the lib. The lib that you needed was downloaded successfully and this is expected, because it exists in the maven repo
The only point I noticed - probably you may have problems with gradle, because there's runProguard command, that is not used in gradle no more.
So you may just delete it or change to minifyEnabled false.
After doing this, demo project assembles successfully

add Youtube Data API in Android Studio using Gradle

Android Studio cannot find the necessary YouTube classes in my application. I'm recycling some code of a previous project. In the previous project I just imported the jar file provided by google. But I want to learn a better way using gradle. I've used gradle before with success. Its awesome when it works. I've been able to add dependencies using gradle before. But for some reason I can't get a google lib to download or activate or whatever it needs to do so that my IDE can find all these missing youtube symbols. I've done the usual syncing with gradle and rebuilding and cleaning and all that but it hasn't helped.
Here is my build.gradle file:
apply plugin: 'com.android.application'
repositories {
mavenCentral()
}
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "dayspringwesleyan.org.dayspringwesleyanchurch"
minSdkVersion 10
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.google.android.gms:play-services:7.5.0'
compile 'com.google.apis:google-api-services-youtube:v3-rev141-1.20.0'
compile 'com.koushikdutta.ion:ion:2.1.6'
}

Why i can't get a dependency on the Google Play Services library?

I know that it has been asked hunderds of times, but I really can't find a solution for my issue.
I have this build file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 20
buildToolsVersion '20.0.0'
defaultConfig {
applicationId "com.gelasoft.gatanki"
minSdkVersion 14
targetSdkVersion 20
versionCode 2
versionName "1.1"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:20.0.0'
compile 'com.android.support:support-v4:20.0.0'
compile 'com.google.android.gms:play-services:0.0.+'
}
Às you can see I'm trying to compile com.google.android.gms:play-services:0.0.+
But I;m getting some scary errors that I really can not manage. I have updated everything and the issue is still there.
Here the errors are:
When I'm trying to sync the project with gradle it says:
Error:Failed to find: com.google.android.gms:play-services:0.0.+
Install Repository and sync project<br>Open File<br>Open in Project Structure dialog
and in my manifest where I'm trying this it can not be resolved as well:
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
I know that I'm missing a really small part on it, but I really can not figure out what is wrong.
Can you give me a push?
AFAIK, there never was a 0.0.x version of the Play Services SDK. Try perhaps compile 'com.google.android.gms:play-services:6.1.11' or compile 'com.google.android.gms:play-services:6.1.+'.

Categories

Resources