java - Gradle Build problems in Android Studio -


my colleague worked on android application on api 21 in android studio 1.4 classpath 'com.android.tools.build:gradle:1.1.0'. also, used java jdk1.7.0_75.

and need continue work on project. i'm having android studio 2.1.1 , want work on api 22 or 23. gradle version classpath 'com.android.tools.build:gradle:2.1.0' , i'm using java jdk1.8.0_91.

if try 'run' app on same android device did, error:

  executing tasks: [:app:assembledebug]  configuration on demand incubating feature. incremental java compilation incubating feature. :app:prebuild up-to-date :app:predebugbuild up-to-date :app:checkdebugmanifest :app:prereleasebuild up-to-date :app:preparecomandroidsupportappcompatv72100library :app:preparecomandroidsupportrecyclerviewv72100library :app:preparecomandroidsupportsupportv42100library :app:preparedebugdependencies :app:compiledebugaidl :app:compiledebugrenderscript :app:generatedebugbuildconfig up-to-date :app:mergedebugshaders up-to-date :app:compiledebugshaders :app:generatedebugassets :app:mergedebugassets up-to-date :app:generatedebugresvalues up-to-date :app:generatedebugresources :app:mergedebugresources :app:processdebugmanifest :app:processdebugresources :app:generatedebugsources :app:incrementaldebugjavacompilationsafeguard :app:compiledebugjavawithjavac :app:compiledebugjavawithjavac - not incremental (e.g. outputs have changed, no previous execution, etc.).  c:\users\z565719\androidstudioprojects\drescherbluetoothcancom\app\src\main\java\z550583\com\navigationdrawer\connectfragment.java:133: error: incomparable types: object , int         if (data.get(userdatabaseadapter.access_name) == 1) {                                                       ^   [24 more errors 1 above...]                                                         ^ note: c:\users\z565719\androidstudioprojects\drescherbluetoothcancom\app\src\main\java\z550583\com\navigationdrawer\mainactivity.java uses unchecked or unsafe operations. note: recompile -xlint:unchecked details. 25 errors  :app:compiledebugjavawithjavac failed  failure: build failed exception. 
  • what went wrong:

    execution failed task ':app:compiledebugjavawithjavac'. compilation failed; see compiler error output details.

  • try: run --stacktrace option stack trace. run --info or --debug option more log output.

    build failed

    total time: 1 mins 40.139 secs

i don't know problem because if try run app laptop (with older android studio ..) app works!

can interpret error

 :app:compiledebugjavawithjavac - not incremental (e.g. outputs have changed, no previous execution, etc.) 

update

@ashishranjan asked file. here connectfragment.java:

public class connectfragment extends fragment { private view rootview;  private toolbar mtoolbar;  private bluetoothcomservice bluetoothcomservice; private boolean isbound = false;  private textview tvdicondi; private progressbar pb; private int currentinitprogress = 0; private int pastinitprogress = 0; private boolean connectiondetailclicked; private imageview ivconnectiondetail;  private togglebutton tglconnect;  private edittext etbaudrate; private edittext etdbcname;  private linearlayout llshowdetail; private linearlayout llconnecttoggle;  private linearlayout llbaudrate; private userdatabaseadapter userdatabaseadapter; private hashmap data;  private connectthread connectthread; private boolean displaythreadloop = true;  private serviceconnection mconnection = new serviceconnection() {     @override     public void onserviceconnected(componentname classname, ibinder service) {         bluetoothcomservice.localbinder binder = (bluetoothcomservice.localbinder) service;         bluetoothcomservice = binder.getservice();         isbound = true;     }      @override     public void onservicedisconnected(componentname name) {         isbound = false;     } };  @override public void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate); }  @override public void onstart() {     super.onstart();     // bindet den bluetoothservice     intent intent = new intent(getactivity(), bluetoothcomservice.class);     getactivity().bindservice(intent, mconnection, getactivity().getapplicationcontext().bind_auto_create); }  @nullable @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) {     rootview = inflater.inflate(r.layout.fragment_connect, container, false);      tvdicondi = (textview) rootview.findviewbyid(r.id.tv_display_connect_description);     ivconnectiondetail = (imageview) rootview.findviewbyid(r.id.arrow_connection_details);     pb = (progressbar) rootview.findviewbyid(r.id.progress_bar_connect);     pb.setprogress(statesingleton.getinstance().getprogressconnectstate());      etbaudrate = (edittext) rootview.findviewbyid(r.id.edit_baud_rate);     etdbcname = (edittext) rootview.findviewbyid(r.id.edit_dbc_name);      llbaudrate = (linearlayout) rootview.findviewbyid(r.id.linear_layout_baud_rate);     llshowdetail = (linearlayout) rootview.findviewbyid(r.id.linear_layout_show_detail);     llconnecttoggle = (linearlayout) rootview.findviewbyid(r.id.linear_layout_connect_toggle);      tglconnect = (togglebutton) rootview.findviewbyid(r.id.connect_toggle);     tglconnect.setchecked(statesingleton.getinstance().gettglconnectstate());     tglconnect.playsoundeffect(soundeffectconstants.click);      userdatabaseadapter = new userdatabaseadapter(getactivity());     data = userdatabaseadapter.getfragmentdata(infosingleton.getinstance().getusername());      mtoolbar = (toolbar) getactivity().findviewbyid(r.id.toolbar_actionbar);      //if (data.get(userdatabaseadapter.access_name) == 1) {     //    llbaudrate.setvisibility(view.visible);     //}      int ersterinteger = (int) data.get(userdatabaseadapter.access_name);     if (ersterinteger == 1){         llbaudrate.setvisibility(view.visible);     } 

the last if (which commented) got error:

data.get(userdatabaseadapter.access_name) == 1

the hint android studio is:

the static member 'z550583.com.sql.userdatabaseadapter.access_name' accessed via instance reference. shows references static methods , fields via class instance rather class itself.

but same hint shown in older android studio version. i'm not sure if problem.

the error says that, data hashmap , get method of hashmap returns object if don't define type of value , need parse value int before comparing 1.

you can :

int yourinteger= (int)data.get(userdatabaseadapter.access_name); if(yourinteger == 1){     //do } 

or

you can define type of value. if you'll define type v get method return object of type v documented here.

so in case, can define object type of key , value in hashmap generics :

hashmap<string,integer> data; 

instead of :

hashmap data; 

Comments

Popular posts from this blog

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -