androiddependenciesbuild.gradleandroid-studio-3.4

Unresolved dependencies and gradle build error


I'm opening a new empty activity in my present project and it is showing the unresolved dependencies error and at the same time showing the Gradle warnings. I'm using Android Studio 3.4 and my Gradle version is 3.4.1.It is also showing add Google Maven repository and sync project, I tried that already but it wont help at all. How can i fix this issue?

allprojects {
        repositories {
            jcenter()
            maven {
               [url "https://maven.google.com"][1]
            }
        }
    }

I added this already but it wont help at all.

First Activity

package com.example.android.miwok;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;

public class MainActivity extends AppCompatActivity {

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

Numbers Activity

package com.example.android.miwok;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;

public class NumbersActivity extends AppCompatActivity {

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

I expect to run the NumbersActivity just fine but the case is not so.


Solution

  • Edit your build.gradle maven portion like this: maven { url 'https://maven.google.com' }
    or
    just use google() instead of this elaborated lines