Tester_at_work
Tester_at_work

Reputation: 99

Gradle failed to sync issue iin IntelliJ

I am sure there has been many posts about Gradle sync issue in INtelliJ, but usually with various types of errors.

I am trying to run a test automation on mobile app, but keep encountering the issues as follow, despite upgrading all possible libraries base on advices given by fellow StackOverflower.

Main code:

import io.appium.java_client.android.AndroidDriver;
import org.junit.Before;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.remote.DesiredCapabilities;

import java.net.MalformedURLException;
import java.net.URL;

/**
 * Instrumented test, which will execute on an Android device.
 *
 * @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
 */
//@RunWith(AndroidJUnit4.class)

public class ExampleInstrumentedTest {
    private AndroidDriver driver;
    @Before
    public void setup() throws MalformedURLException {
        DesiredCapabilities capabilities = new DesiredCapabilities();
        capabilities.setCapability("deviceName", "emulator-5444");
        capabilities.setCapability("platFormName","Android");
        capabilities.setCapability("appPackage","com.mol.molwallet.uat");
        capabilities.setCapability("appActivity","com.mol.molwallet.start.SplashActivity");
        capabilities.setCapability("noReset","true");
        driver = new AndroidDriver(new URL("http://127.0.0.1:4725/wd/hub"),capabilities);
    }
    @Test
    public void myFirstTest() {
        // Context of the app under test.
        driver.findElement(By.xpath("//*[@text='LOG IN']")).click();
        //assertEquals("com.example.test", appContext.getPackageName());
    }
}

App/build.gradle

android {
    compileSdkVersion 29
    buildToolsVersion "29.0.1"
    defaultConfig {
        applicationId "com.example.test"
        minSdkVersion 15
        targetSdkVersion 29
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {

    implementation fileTree(dir: 'libs', include: ['*.jar'])
    noinspection GradleCompatible
    //implementation 'com.android.support:appcompat-v7:29+'
    implementation 'androidx.appcompat.appcompat:1.0.0'
    //implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    testImplementation 'junit:junit:4.12'
    implementation 'androidx.annotation:annotation:1.1.0'
    //androidTestImplementation 'com.android.support.test:runner:1.0.2'
    //androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    //androidTestImplementation 'com.android.support:support-annotations:24.0.0'
    //implementation("com.android.support:support-v4:27.1.1")
    implementation project(':react-native-fast-image')

}
if(hasProperty('buildScan')){
    buildScan {
        termsOfServiceUrl = 'https://gradle.com/terms-of-service';
        termsOfServiceAgree = 'yes'
    }
}

And the error message is as follow when I try to run the main code enter image description here

Hope to have advice on this issue which has been bugging me.

Upvotes: 0

Views: 81

Answers (1)

Hayk Melkonyan
Hayk Melkonyan

Reputation: 2150

try this

    //noinspection GradleCompatible

Upvotes: 1

Related Questions