2

I want to use android.support.v7.widget.SwitchCompat

This is more of a problem than I ever imagined. I need to know the exact steps to include v7 compatibility library in maven build.

So far I either run into class not found error on android.support.v7.widget.SwitchCompat or when I include that jar,or I get exception related to not finding R.attr at runtime when it compiles ok.

So I need to know exactly what needs to be done to compile v7 so that everything I need is in the APK.

I don't see that classes.jar inside apklib even has the R.attr etc.

Could someone just tell me exactly what I need to do include v7 compatibility in my maven build.

  <dependency>
      <groupId>android.support</groupId>
      <artifactId>compatibility-v7</artifactId>
      <version>23.0.1</version>
      <type>apklib</type>
      <scope>system</scope>
      <systemPath>${basedir}/libs/appcompat-v7-23.0.1.jar</systemPath> 
    </dependency> 
   <dependency>
       <groupId>com.android.support</groupId>
       <artifactId>appcompat-v7</artifactId>
       <version>23.0.1</version>
       <type>jar</type>
       <scope>system</scope>
      <systemPath>${basedir}/libs/android-support-v7-appcompat.jar</systemPath> 
   </dependency>

I have seen it said before to use compile scope, but this is not available if the libs are on system. It must use system scope.

Now in the past I always use eclipse, and when something was missing at runtime it was always just a matter of 'exporting' certain jars in ide, so now with pure maven pom build, I don't know what to do. It needs to be built on server where eclipse is not part of the build process. What I am not getting is what is telling the build to include the classes like R.attr at runtime related to this UI library? I need to resources at runtime. In the past, I always just depended on eclipse exporting of jars for this and link to the library. Now it is not so clear ...

Can someone tell me how to tell maven to check my local repo for items? Right now if it does not find an item on server it ends in error even if I installed items locally in on files system \username.m2

MuayThai
  • 441
  • 1
  • 5
  • 19
  • Have you tried this [answer](http://stackoverflow.com/questions/18380337/android-support-library-setup-with-maven#22602712) ? – Sharp Edge Oct 26 '15 at 06:21
  • I tried it just now, but it still looks for it on server. Even when I remove the server on list of repo's and just have the file repo... android-support file://${env.ANDROID_HOME}/extras/android/m2repository – MuayThai Oct 26 '15 at 07:01
  • That's all i have in under repo's but I still see error message: he following artifacts could not be resolved: com.android.support:appcompat-v7:aar:23.0.1, com.android.support:support-v4:jar:23.0.1: Failure to find com.android.support:appcompat-v7:aar:23.0.1 in was cached in the local repository, resolution will not be reattempted until the update interval of server has elapsed or updates are forced -> – MuayThai Oct 26 '15 at 07:03
  • @Sharp Edge yes, I tried this. However it deals only with jar include. In the case of Android Library this is apk lib or aar. This seems not to be working. – MuayThai Oct 28 '15 at 03:26
  • Still not fixed! Does anyone know what can be done about this? – MuayThai Oct 28 '15 at 03:35
  • Looking at the answer it says that i deals with aar files as well... `file://${env.ANDROID_HOME}/extras/android/m2repository` .. have you defined the environmental variable `ANDROID_HOME` ? – Sharp Edge Oct 28 '15 at 05:48

0 Answers0