1

the first gradle code is as below i shall be glad for your response.the error in the run says cannot resolve all the dependencies. which include; auth,core,and database.

apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.2"
    defaultConfig {
        applicationId "com.appsound.instagram.tinder"
        minSdkVersion 14
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:25.3.1'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'com.google.firebase:firebase-core:11.8.0'
    compile 'com.google.firebase:firebase-database:11.8.0'
    compile 'com.google.firebase:firebase-auth:11.8.0'
    compile 'com.lorentzos.swipecards:library:1.0.9'
    testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'

The second gradle code is as shown below i shall be glad for your response.the error in the run says cannot resolve all the dependencies. which include; auth,core,and database.

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.2'
        classpath 'com.google.gms:google-services:3.0.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

the main activity java code is as shown below i shall be glad for your response.the error in the run says cannot resolve all the dependencies. which include; Auth,core,and database.

package com.appsound.instagram.tinder;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.widget.ArrayAdapter;
import android.widget.Toast;

import com.lorentzos.flingswipe.SwipeFlingAdapterView;

import java.util.ArrayList;

public class MainActivity extends AppCompatActivity {

    private ArrayList<String> al;
    private ArrayAdapter<String> arrayAdapter;
    private int i;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        al = new ArrayList<>();
        al.add("php");
        al.add("c");
        al.add("python");
        al.add("java");
        al.add("html");
        al.add("c++");
        al.add("css");
        al.add("javascript");

        arrayAdapter = new ArrayAdapter<>(this, R.layout.item, R.id.helloText, al);


        SwipeFlingAdapterView Flingcontainer = ( SwipeFlingAdapterView) findViewById(R.id.frame);
        Flingcontainer.setAdapter(arrayAdapter);
        Flingcontainer.setFlingListener(new SwipeFlingAdapterView.onFlingListener(){
            @Override
            public void removeFirstObjectInAdapter() {
                // this is the simplest way to delete an object from the Adapter (/AdapterView)
                Log.d("LIST", "removed object!");
                al.remove(0);
                arrayAdapter.notifyDataSetChanged();
            }

            @Override
            public void onLeftCardExit(Object dataObject) {
                //Do something on the left!
                //You also have access to the original object.
                //If you want to use it just cast it (String) dataObject
                Toast.makeText(MainActivity.this, "left", Toast.LENGTH_SHORT).show();
            }

            @Override
            public void onRightCardExit(Object dataObject) {
                Toast.makeText(MainActivity.this, "right", Toast.LENGTH_SHORT).show();
            }

            @Override
            public void onAdapterAboutToEmpty(int itemsInAdapter) {
                // Ask for more data here
                al.add("XML ".concat(String.valueOf(i)));
                arrayAdapter.notifyDataSetChanged();
                Log.d("LIST", "notified");
                i++;
            }

            @Override
            public void onScroll(float scrollProgressPercent) {

            }

        });


        // Optionally add an OnItemClickListener
        Flingcontainer.setOnItemClickListener(new SwipeFlingAdapterView.OnItemClickListener() {
            @Override
            public void onItemClicked(int itemPosition, Object dataObject) {
                Toast.makeText(MainActivity.this, "click", Toast.LENGTH_SHORT).show();
            }
        });

    }
}

i shall be glad for your response.the error in the run says cannot resolve all the dependencies. which include; auth,core,and database.

1 Answers1

1

Read Dependency types.

  • Set :gradle:3.0.1
  • Add google()

Add Google's Maven repository in your top-level build.gradle file:

allprojects {
    repositories {
        google()
        jcenter()
    }
}

DEMO

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        google()
        jcenter()
    }
    dependencies {
       classpath 'com.android.tools.build:gradle:3.0.1'
        classpath 'com.google.gms:google-services:3.0.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

build.gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 27
    buildToolsVersion "27.0.2"
    defaultConfig {
        applicationId "com.appsound.instagram.tinder"
        minSdkVersion 14
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:27.0.2'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'com.google.firebase:firebase-core:11.8.0'
    compile 'com.google.firebase:firebase-database:11.8.0'
    compile 'com.google.firebase:firebase-auth:11.8.0'
    compile 'com.lorentzos.swipecards:library:1.0.9'
    testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'

FYI

Open gradle-wrapper.properties and make sure, you are using gradle-4.1-all version.

distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
IntelliJ Amiya
  • 74,896
  • 15
  • 165
  • 198
  • i expect to receive no error when i sync gradle please help –  Feb 19 '18 at 11:33
  • @moses You should `Clean-Rebuild-Sync` project at first – IntelliJ Amiya Feb 19 '18 at 11:34
  • 1
    Error:A problem occurred configuring project ':app'. > Could not resolve all dependencies for configuration ':app:_debugApkCopy'. > Could not find com.google.firebase:firebase-core:11.8.0. Required by: project :app > Could not find com.google.firebase:firebase-database:11.8.0. Required by: project :app > Could not find com.google.firebase:firebase-auth:11.8.0. Required by: project :app –  Feb 19 '18 at 11:38
  • @moses kindly use latest `build.gradle` and then RESTART IDE and run. – IntelliJ Amiya Feb 19 '18 at 11:43
  • which is the latest gradle please send a code..and how do i restart IDE. –  Feb 19 '18 at 11:48
  • @moses Under `File > Invalidate Caches/Restart` – IntelliJ Amiya Feb 19 '18 at 11:54
  • Error:Could not find com.android.tools.build:gradle:3.0.1. Searched in the following locations: file:/C:/Program Files/Android/Android Studio8/gradle/m2repository/com/android/tools/build/gradle/3.0.1/gradle-3.0.1.pom file:/C:/Program Files/Android/Android Studio8/gradle/m2repository/com/android/tools/build/gradle/3.0.1/gradle-3.0.1.jar https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.1/gradle-3.0.1.pom https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.1/gradle-3.0.1.jar Required by: project : –  Feb 19 '18 at 12:03
  • @moses https://stackoverflow.com/questions/47515676/gradle-4-1-issue-on-latest-android-studio-3-0-1 – IntelliJ Amiya Feb 19 '18 at 12:06
  • Error:(29, 13) Failed to resolve: com.google.firebase:firebase-database:11.8.0 Show in File
    Show in Project Structure dialogError:(28, 13) Failed to resolve: com.google.firebase:firebase-core:11.8.0 Error:(30, 13) Failed to resolve: com.google.firebase:firebase-auth:11.8.0
    –  Feb 19 '18 at 12:07