杰克:方法&#39;无效<clinit>()&#39;没有在类型中找到

时间:2016-04-27 17:05:58

标签: android

我已经在Android Studio 2.1中启用了Jack,其中包含构建工具版本24 rc3。我开始使用lambda但是当我尝试构建Gradle时抛出此错误:

Execution failed for task ':app:compileDebugJavaWithJack'.
> java.io.IOException: com.android.jack.api.v01.CompilationException: Method 'void <clinit>()' not found in type 'org.dollars_bbs.thedollarscommunity.activities.ChatActivity$ChatFragment$ChatRefresherThread$1$-void_run__LambdaImpl0'

下面:

public class PasswordActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_password);
        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);

        View.OnClickListener c = v->{
            TextView t = ((TextView) findViewById(R.id.textView));
            assert t != null;
            if (equal(t.getText().toString(), "xx")) {
                Intent intent = new Intent(getApplicationContext(), MainActivity.class);
                //Clears the Stack so that BACK won't lead here.
                intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | IntentCompat.FLAG_ACTIVITY_CLEAR_TASK);
                startActivity(intent);

            } else
                Snackbar.make(v, getString(R.string.wrong), Snackbar.LENGTH_LONG).setAction("Action", null).show();
        };

        View b = findViewById(R.id.button);
        if(b != null) b.setOnClickListener(c);
    }

}

我尝试过清洁并重新启动。我不明白为什么会抛出错误,也无法在Google上找到它 全栈:

com.android.jack.api.v01.CompilationException: Method 'void <clinit>()' not found in type 'org.dollars_bbs.thedollarscommunity.activities.PasswordActivity$-void_onCreate_android_os_Bundle_savedInstanceState_LambdaImpl0'
    at com.android.jack.api.v01.impl.Api01ConfigImpl$Api01CompilationTaskImpl.run(Api01ConfigImpl.java:111)
    at com.android.builder.core.AndroidBuilder.convertByteCodeUsingJackApis(AndroidBuilder.java:1931)
    at com.android.build.gradle.tasks.JackTask.doMinification(JackTask.java:148)
    at com.android.build.gradle.tasks.JackTask.access$000(JackTask.java:73)
    at com.android.build.gradle.tasks.JackTask$1.run(JackTask.java:112)
    at com.android.builder.tasks.Job.runTask(Job.java:51)
    at com.android.build.gradle.tasks.SimpleWorkQueue$EmptyThreadContext.runTask(SimpleWorkQueue.java:41)
    at com.android.builder.tasks.WorkQueue.run(WorkQueue.java:223)
    at java.lang.Thread.run(Thread.java:745)
Caused by: com.android.jack.lookup.JMethodWithReturnLookupException: Method 'void <clinit>()' not found in type 'org.dollars_bbs.thedollarscommunity.activities.PasswordActivity$-void_onCreate_android_os_Bundle_savedInstanceState_LambdaImpl0'
    at com.android.jack.ir.ast.JDefinedClassOrInterface.getMethod(JDefinedClassOrInterface.java:287)
    at com.android.jack.ir.ast.JDefinedClassOrInterface.getMethod(JDefinedClassOrInterface.java:298)
    at com.android.jack.transformations.FieldInitializer.run(FieldInitializer.java:57)
    at com.android.jack.transformations.FieldInitializer.run(FieldInitializer.java:42)
    at com.android.sched.scheduler.ScheduleInstance.runWithLog(ScheduleInstance.java:161)
    at com.android.sched.scheduler.MultiWorkersScheduleInstance$SequentialTask.process(MultiWorkersScheduleInstance.java:442)
    at com.android.sched.scheduler.MultiWorkersScheduleInstance$Worker.run(MultiWorkersScheduleInstance.java:162)

1 个答案:

答案 0 :(得分:0)

此错误似乎已在Android SDK Build-tools版本24中解决。