I was using gradle 3.3 as in Gradle wrapper properties and I tried to build the apk, and it was showing the error that gradle version isn't supported and upgrade gradle to use this feature. So I upgraded the gradle to 4.1 using this statement in gradele wrapper properties. distributionUrl=https://services.gradle.org/distributions/gradle-4.1-all.zip And while I was emulating the application in my mobile, there was no error and an error occured on opening a new activity on a click from cardview. The error was at setContentView(R.layout.activity_quiz); and when I'm running a backup copy of the same project having gradle of 3.3 everything works fine, but I'm unable to create apk file
答案 0 :(得分:0)
You also need to open project build.gradle
and modify buildscript->dependencies->classpath to as below
classpath 'com.android.tools.build:gradle:3.0.1'
答案 1 :(得分:0)
首先尝试从那里清除你的android studio缓存file>invalidate caches/restart>validated and restart
,你可以清除builds>clean project
中的项目并尝试在builds
中重建项目