gradle - error: package android.support.design.widget does not exist -
i'm new android. when want import project android studio complain error : error package android.support.design.widget not exist
here code :
public class catalogactivity extends appcompatactivity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_catalog); // setup fab open editoractivity floatingactionbutton fab = (floatingactionbutton) findviewbyid(r.id.fab); fab.setonclicklistener(new view.onclicklistener() { @override public void onclick(view view) { intent intent = new intent(catalogactivity.this, editoractivity.class); startactivity(intent); } }); } }
and build.gradle:
apply plugin: 'com.android.application' android { compilesdkversion 25 buildtoolsversion "25.0.2" defaultconfig { applicationid "com.example.android.pets" minsdkversion 16 targetsdkversion 23 versioncode 1 versionname "1.0" } buildtypes { release { minifyenabled false proguardfiles getdefaultproguardfile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { compile filetree(include: ['*.jar'], dir: 'libs') testcompile 'junit:junit:4.12' compile 'com.android.support:appcompat-v7:25.3.1' compile 'com.getbase:floatingactionbutton:1.9.1' }
how can solve problem , 1 thing every time want import else project android studio there bunch of error , need change build.gradle , build.gradle.properties , every time have problem . can give me reference build.gradle learn how should ?
floating action buttons used special type of promoted action. need add com.android.support:design library
include line in build.gradle:
compile dependencies
in build.gradle
:
compile 'com.android.support:design:25.3.1'
Comments
Post a Comment