2
科特林Android的搖籃
我不能編譯我的科特林Android應用程序Android Studio中執行失敗的任務compilefreeDebugKotlin
我有錯誤gradle這個構建faile:
Error:Execution failed for task ':app:compilefreeDebugKotlin'.
> com.android.build.gradle.api.BaseVariant.getProcessResources()Lcom/android/build/gradle/tasks/ProcessAndroidResources;
在我的項目,我描述了一個簡單的適配器
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
}
對於編譯我使用了defau lt gradle build script and Android Studio 1.0.0