如何修复“错误:未找到Gradle DSL方法:'testImplementation()'”

时间:2019-07-09 11:27:10

标签: android android-studio build.gradle

已解决!!我完全删除了Android Studio和gradle文件。然后我重新安装了Android Studio,但我不知道如何解决,但解决了。


我使用IDE和插件将Android Studio更新为最新版本。但是后来出现了这个错误。

我尝试了所有可见的答案,但即使如此,这些答案也无法解决我的问题。这是我尝试过的一些事情:

  • 将testImplementation更改为testİmplementation...
  • 更改gradle版本(从Project Structure或手动更改)
  • 更新最新的gradle版本(5.5)

  • ...

use strict; use warnings; my $texcontent = ' Sample content... Need to place the above figure text near to citation end of paragraph, Citation would be in text ".... (\hyperref[F9]{\textbf{Figure~1}})." Need to place the above figure text near to citation end of paragraph, Citation would be in text ".... (\hyperref[F9]{\textbf{Figure~2}})." Need to place the above figure text near to citation end of paragraph, Citation would be in text ".... (\hyperref[F9]{\textbf{Figure~9}})." Need to place the above figure text near to citation end of paragraph, Citation would be in text ".... (\hyperref[F9]{\textbf{Figure~3}})." %%Figure-1 \begin{figure}[t] \figurebox{}{}{1}[fgene-10-00561-g009] \caption{Ectopic expression of \textit{TaPP2C135} in \textit{Arabidopsis}. \textbf{(A)}~Expression levels of} \end{figure} %%Figure-2 \begin{figure}[t] \figurebox{}{}{1}[fgene-10-00561-g009] \caption{Ectopic expression of \textit{TaPP2C135} in \textit{Arabidopsis}. \textbf{(A)}~Expression levels of} \end{figure} %%Figure-3 \begin{figure}[t] \figurebox{}{}{1}[fgene-10-00561-g009] \caption{Ectopic expression of \textit{TaPP2C135} in \textit{Arabidopsis}. \textbf{(A)}~Expression levels of} \end{figure} '; my ($pre,$match,$post) = ""; while($texcontent=~m/\%\%(Figure\-(?:[\w]+))\n?\\begin\{(figure\*?)\}((?:(?!\\end\{\2\}).)*)\\end\{\2\}/gs) { $pre = $pre.$`; $match = $&; $post = $'; (my $figId = $1)=~s/\-/\~/i; #%%Figure-1 replaced with Figure~1 if($pre=~m/$figId\}\}\)/i) #Searching the ID { $match=~s/\{figure/\{completedfigure/i; #Completed the figures changed to completedfigures. $pre=~s/$figId\}\}\)/$&\n<figplacedhere>$match<figplacedhere>/i; #TAG Placed figures identification $match = ""; } $pre = $pre.$match; $texcontent = $post; } if(length $pre) { $texcontent = $pre.$post; } $texcontent=~s/<figplacedhere>//g; $texcontent=~s/\{completedfigure/\{figure/g; print "--\n$texcontent\n--\n"; (内容)

public class MainActivity extends AppCompatActivity {
    Database myDB;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
    myDB = new Database(MainActivity.this);
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    SectionsPagerAdapter sectionsPagerAdapter = new SectionsPagerAdapter(this, getSupportFragmentManager());
    ViewPager viewPager = findViewById(R.id.view_pager);
    viewPager.setAdapter(sectionsPagerAdapter);
    TabLayout tabs = findViewById(R.id.tabs);
    tabs.setupWithViewPager(viewPager);
    Alert();
}


public void Dialog() {
    AlertDialog.Builder alert01 = new AlertDialog.Builder(MainActivity.this);
    alert01.setTitle("Congratulations ! ");
    alert01.setMessage("You've purchased the most expensive app in the world ! ");

    Database myDB;
    myDB = new Database(MainActivity.this);
    Cursor res = myDB.getAllData();

    if(res.getCount() == 0) {
        // show message
        showMessage("Error","Nothing found");
        return;
    }

    StringBuffer buffer = new StringBuffer();
    while (res.moveToNext()) {
        buffer.append("Name :"+ res.getString(1)+"\n");
    }

    showMessage("Data",buffer.toString());
}

public void Alert (){
AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this,R.style.MyDialogTheme);

View v = LayoutInflater.from(MainActivity.this).inflate(R.layout.dialog0,null);
builder.setMessage("Welcome ! ");
builder.setView (v);
builder.setPositiveButton("Submit", new DialogInterface.OnClickListener() {
    @Override
    public void onClick(DialogInterface dialog, int which) {
        EditText edituser ;
        edituser = (EditText) findViewById(R.id.edit_username);
        boolean isInserted = myDB.DataInput(edituser.getText().toString());
        if(isInserted == true)
            Toast.makeText(MainActivity.this,"Data Inserted",Toast.LENGTH_LONG).show();
        else
            Toast.makeText(MainActivity.this,"Data not Inserted",Toast.LENGTH_LONG).show();
        Dialog();
    }})
    .setNegativeButton("Cancel",null)
    .setCancelable(false);

    AlertDialog alert = builder.create();
    alert.show();
}

public void showMessage(String title,String Message){
    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder.setCancelable(true);
    builder.setTitle(title);
    builder.setMessage(Message);
    builder.show();

build.gradle(应用程序)

// 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.4.1'
    }
}

allprojects {
    repositories {
        google()
        jcenter()

    }
}

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

这是错误消息,在我的构建控制台中(我尝试了建议):

build.gradle

0 个答案:

没有答案