小编Sha*_*nse的帖子

无法解析符号AndroidJUnit4

我正在尝试为我的应用添加loginfacebook.但是当我添加一个需要这样做的存储库时.它导致了一个错误.AndroidJUnit4现在无法解决.

ExampleInstrumentedTest.java

package com.example.user.enyatravelbataan;

import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;

import org.junit.Test;
import org.junit.runner.RunWith;

import static junit.framework.Assert.assertEquals;
import static org.junit.Assert.*;

/**
 * Instrumentation 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 {
@Test
public void useAppContext() throws Exception {
    // Context of the app under test.
    Context appContext = InstrumentationRegistry.getTargetContext();

    assertEquals("com.example.user.enyatravelbataan", 
appContext.getPackageName());
}
}
Run Code Online (Sandbox Code Playgroud)

这是我的构建:gradle(app)

apply plugin: 'com.android.application'

 android {
compileSdkVersion 24
buildToolsVersion "24.0.3"
useLibrary 'org.apache.http.legacy'


repositories {
    mavenCentral() …
Run Code Online (Sandbox Code Playgroud)

java junit4 facebook-login android-studio android-instrumentation

8
推荐指数
2
解决办法
1万
查看次数