android - Cannot acces ActivityCompatApi23 when trying to use FragmentActivity -


i'm trying use viewpager on smartwatch, keep getting error when trying rebuild/run/debug application. i'm using fragmentactivity, error occurs. searched stackoverflow , tutorial websites see problem, , lot of results related build.gradle files. tried pretty stumbled upon, error didn't change once.

the error:

error: cannot acces activitycompatapi23 

the error happens on line, coming piece of code below.

public class wearmainactivity extends fragmentactivity { 

wearmainactivity.java

package be.ehb.dt.finalwork_lievenluyckx_v001;  import android.os.bundle; import android.support.v4.app.fragment; import android.support.v4.app.fragmentactivity; import android.support.v4.view.pageradapter; import android.support.v4.view.viewpager;  import java.util.list; import java.util.vector;  /**  * created lieven on 14/08/17.  */  public class wearmainactivity extends fragmentactivity {       private pageradapter pageradapter;      /* (non-javadoc)       * @see android.support.v4.app.fragmentactivity#oncreate(android.os.bundle)       */     @override     protected void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         super.setcontentview(r.layout.viewpager);         //initialsie pager         initialisepaging();     }      /**      * initialise fragments paged      */     private void initialisepaging() {          list<fragment> fragments = new vector<fragment>();         fragments.add(fragment.instantiate(this, monitor.class.getname()));         fragments.add(fragment.instantiate(this, currentsongoverviewwear.class.getname()));         this.pageradapter  = new mypageradapter(getsupportfragmentmanager(), fragments);          viewpager pager = (viewpager) findviewbyid(r.id.viewpager_container);         pager.setadapter(this.pageradapter);     } } 

build.gradle (wear)

apply plugin: 'com.android.application'  android {     allprojects {         repositories {             jcenter()             maven {                 url "https://maven.google.com"             }         }     }      compilesdkversion 25     buildtoolsversion "25.0.1"     defaultconfig {         applicationid "be.ehb.dt.finalwork_lievenluyckx_v001"         minsdkversion 25         targetsdkversion 25         versioncode 1         versionname "1.0"      }     buildtypes {         release {             minifyenabled false             proguardfiles getdefaultproguardfile('proguard-android.txt'), 'proguard-rules.pro'         }     }  }  dependencies {     compile 'com.android.support:wear:26.0.0'     compile 'com.android.support:appcompat-v7:25.1.1'     compile 'com.google.android.support:wearable:2.0.3'     compile 'com.google.android.gms:play-services:11.0.4'     provided 'com.google.android.wearable:wearable:2.0.3'     compile 'com.android.support:support-v4:26.0.0-alpha1' } 

i experienced similar issue when using appcompatactivity:

error: cannot access activitycompatapi23

i fixed setting specific support library version:

compile 'com.android.support:appcompat-v7:26.+' <-- old compile 'com.android.support:appcompat-v7:26.0.2' <-- new 

Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -