2

Kotlin Android Gradle

I can't compile my Kotlin Android application

I have gradle build faile with error:

 Error:Execution failed for task ':app:compilefreeDebugKotlin'. > com.android.build.gradle.api.BaseVariant.getProcessResources()Lcom/android/build/gradle/tasks/ProcessAndroidResources; 

In my project, I described a simple adapter

import android.widget.TextView import android.content.Context import java.util.ArrayList import com.idunnololz.widgets.AnimatedExpandableListView import android.view.View import android.view.ViewGroup import android.view.LayoutInflater public class ExpListAdapter(vcontext: Context, vgroups: ArrayList<String>, vtitles: ArrayList<ArrayList<String>>) : AnimatedExpandableListView.AnimatedExpandableListAdapter() { var titles = vtitles var context = vcontext var groups = vgroups override fun getGroupCount(): Int = titles.size() override fun getGroup(groupPosition: Int): Any = titles.get(groupPosition) override fun getChild(groupPosition: Int, childPosition: Int): Any = titles.get(groupPosition).get(childPosition) override fun getGroupId(groupPosition: Int): Long = groupPosition.toLong() override fun getChildId(groupPosition: Int, childPosition: Int): Long = childPosition.toLong() override fun hasStableIds(): Boolean = true override fun getGroupView(groupPosition: Int, isExpanded: Boolean, convertView: View?, parent: ViewGroup): View? { var convertView = convertView if ( convertView == null) { val inflater = context.getSystemService(Context.LAYOUT_INFLATER_SERVICE) as LayoutInflater convertView = inflater.inflate(R.layout.start_parent, parent, false) } val textGroup = convertView?.findViewById(R.id.tv_parent_size) as TextView textGroup.setText(groups.get(groupPosition)) val textGroupnum = convertView?.findViewById(R.id.tv_parent_numbet) as TextView textGroupnum.setText(java.lang.String.valueOf(groupPosition + 1)) return convertView as View } override fun getRealChildView(groupPosition: Int, childPosition: Int, isLastChild: Boolean, convertView: View?, parent: ViewGroup): View? { var convertView = convertView if (convertView == null) { val inflater = context.getSystemService(Context.LAYOUT_INFLATER_SERVICE) as LayoutInflater convertView = inflater.inflate(R.layout.start_childer, parent, false) } val textChild = convertView!!.findViewById(R.id.tv_children_name) as TextView textChild.setText(titles.get(groupPosition).get(childPosition)) return convertView as View } override fun getRealChildrenCount(groupPosition: Int): Int = titles.get(groupPosition).size() override fun isChildSelectable(groupPosition: Int, childPosition: Int): Boolean = true } 

For compile I'm used default gradle build script and Android Studio 1.0.0

1 Answer 1

3

Try to update kotlin-gradle-plugin version to 0.9.976 in build.gradle file.

buildscript { repositories { mavenCentral() } dependencies { classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:0.9.976' } } 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.