Thanks pfn for your unvaluable assistance.
I haven't modified much my previous Build.scala:
object Build extends android.AutoBuild {
lazy val raiz = (project in file(".")).settings(
android.Plugin.androidCommands: _*
)
lazy val IncidenciasS = project.settings(
configScala ++ Seq(
transitiveAndroidLibs in Android := false,
//resolvers += Resolver.url("http://jcenter.bintray.com"),
libraryDependencies ++= Seq(
scaloid
//"com.google.android" % "multidex" % "0.1",
//"com.novocode" % "junit-interface" % "0.9" %
"test",
//"junit" % "junit" % "4.11" %
"test",
//"org.scalatest" %% "scalatest" % "2.1.4" %
"test",
//"org.robolectric" % "robolectric" % "2.3" %
"test"
)
): _*
).dependsOn(BiblS)
lazy val BiblS = project.settings(
android.Plugin.androidBuildApklib ++ configLib ++ Seq(
scalaVersion := "2.10.4",
libraryDependencies ++= Seq(
scaloid,
support
)
): _*
)
val scaloid = "org.scaloid" %% "scaloid" % "3.2.1-8"
val support = "com.android.support" % "appcompat-v7" % "19.1.0"
//=============================Configuraciones
lazy val configComun = Seq(
platformTarget in Android := "android-17",
sourcesInBase := false
)
lazy val configLib = configComun ++ Seq(
exportJars := true
)
lazy val configApl = configComun ++ Seq(
useProguard in Android := true,
proguardOptions in Android += proguardEstandar,
packageDebug <<= packageDebug in Android,
run <<= run in Android,
install <<= install in Android,
javacOptions ++= Seq("-source", "1.7", "-target", "1.7"),
javacOptions in Compile <<= (javacOptions in Compile) map { _ collect {
case "1.5" => "1.7"
case s => s
}
},
managedClasspath in Test <++= (platformJars in Android, baseDirectory)
map {
case ((j,_), b) =>
Seq(Attributed.blank(b / "bin" / "classes"),
Attributed.blank(file(j)))
},
debugIncludesTests in Android := false,
dexMaxHeap in Android := "8192m",
// Librerias usadas en todos los proyectos
libraryDependencies ++= Seq(
"ch.acra" % "acra" % "4.5.0"
)
)
lazy val configScala = android.Plugin.androidBuild(BiblS) ++ configApl ++
Seq(
proguardOptions in Android += proguardScala,
scalaVersion := "2.10.4",
scalacOptions in Compile += "-feature",
scalacOptions in (Compile, compile) ++= Seq(
"-target:jvm-1.7"
),
proguardCache in Android ++= Seq(
ProguardCache("org.scaloid") % "org.scaloid"
),
libraryDependencies ++= Seq(
"org.scala-lang" % "scala-library" % scalaVersion.value
)
)
val proguardEstandar =
"""
|-dontpreverify
|-dontoptimize
|-dontobfuscate
|-flattenpackagehierarchy
|-dontusemixedcaseclassnames
|-dontskipnonpubliclibraryclasses
|-verbose
|
|# Evitar avisos de clases no existentes desde ch.qos.logback.core
|-dontwarn javax.mail.**
|-dontwarn javax.naming.Context
|-dontwarn javax.naming.InitialContext
|-dontwarn android.app.Application**
|-dontwarn java.lang.String
|-dontskipnonpubliclibraryclasses
|
|-keep public class * extends android.app.Activity
|-keep public class * extends android.app.Application
|-keep public class * extends android.app.Service
|-keep public class * extends android.content.BroadcastReceiver
|-keep public class * extends android.content.ContentProvider
|-keep public class * extends android.app.backup.BackupAgentHelper
|-keep public class * extends android.preference.Preference
|-keep public class * extends android.view.View
|-keep public class com.android.vending.licensing.ILicensingService
|
|-keep public class * extends android.app.Fragment
|-keep public class * extends android.support.v4.app.Fragment
|
|-keepclasseswithmembernames class * {
| native <methods>;
|}
|
|-keepclasseswithmembers class * {
| public <init>(android.content.Context, android.util.AttributeSet);
|}
|
|-keepclasseswithmembers class * {
| public <init>(android.content.Context, android.util.AttributeSet,
int);
|}
|
|-keepclassmembers enum * {
| public static **[] values();
| public static ** valueOf(java.lang.String);
|}
|
|# As described in tools/proguard/examples/android.pro - ignore all
warnings.
|-dontwarn android.support.v4.**
|
|# The maps library uses custom Parcelables. Use this rule (which is
slightly
|# broader than the standard recommended one) to avoid obfuscating them.
|-keepclassmembers class * implements android.os.Parcelable {
| static *** CREATOR;
|}
|
|# Missing annotations are harmless.
|-dontwarn sun.misc.Unsafe
|-dontwarn javax.annotation.**
|
|######## Opciones para ACRA:
|# we need line numbers in our stack traces otherwise they are pretty
useless
|-renamesourcefileattribute SourceFile
|-keepattributes SourceFile,LineNumberTable
|
|# ACRA needs "annotations" so add this...
|-keepattributes *Annotation*
|
|-keep class org.acra.ReportingInteractionMode {
| *;
|}
|
|-keepnames class org.acra.sender.HttpSender$** {
| *;
|}
|
|-keepnames class org.acra.ReportField {
| *;
|}
|
|# keep this otherwise it is removed by ProGuard
|-keep public class org.acra.ErrorReporter
|{
| public void addCustomData(java.lang.String,java.lang.String);
| public void putCustomData(java.lang.String,java.lang.String);
| public void removeCustomData(java.lang.String);
|}
|
|# keep this otherwise it is removed by ProGuard
|-keep public class org.acra.ErrorReporter
|{
| public void handleSilentException(java.lang.Throwable);
|}
|
|# Si esto no se hace peta en nuevo movil de Ramon
|-keep class
org.acra.jraf.android.util.activitylifecyclecallbackscompat.ActivityLifecycleCallbacksWrapper
{
| *;
|}
""".stripMargin
val proguardMapas =
"""
|# We restrict a few more optimizations for the maps library.
|-optimizations
!code/simplification/arithmetic,!field/*,!class/merging/*,!code/simplification/variable
|
|# The maps library uses serialization so keep this.
|-keepclassmembers class * implements java.io.Serializable {
| static final long serialVersionUID;
| static final java.io.ObjectStreamField[] serialPersistentFields;
| private void writeObject(java.io.ObjectOutputStream);
| private void readObject(java.io.ObjectInputStream);
| java.lang.Object writeReplace();
| java.lang.Object readResolve();
|}
|
|# The maps library uses custom Parcelables. Use this rule (which is
slightly
|# broader than the standard recommended one) to avoid obfuscating them.
|-keepclassmembers class * implements android.os.Parcelable {
| static *** CREATOR;
|}
|
|#
https://groups.google.com/d/topic/guava-discuss/YCZzeCiIVoI/discussion
|-dontwarn com.google.common.collect.MinMaxPriorityQueue
|
|-dontnote javax.xml.**
|-dontnote org.w3c.dom.**
|-dontnote org.xml.sax.**
|
|# Additional ones needed for Maps API library.
|-keep public class
com.google.googlenav.capabilities.CapabilitiesController*
|
|# Ignore invalid constant ref. See
|#
https://groups.google.com/d/topic/guava-discuss/YCZzeCiIVoI/discussion
|-dontwarn com.google.common.collect.MinMaxPriorityQueue
""".stripMargin
val proguardScala =
"""
|-dontwarn scala.**
|-dontnote scala.Enumeration
|
|# workaround for https://issues.scala-lang.org/browse/SI-5397
|-keep class scala.collection.SeqLike {
| public protected *;
|}
|-keep public class scala.Option
|-keep public class scala.Function0
|-keep public class scala.Function1
|-keep public class scala.Function2
|-keep public class scala.Product
|-keep public class scala.Tuple2
|
|-keep public class scala.collection.Seq
|-keep public class scala.collection.immutable.List
|-keep public class scala.collection.immutable.Map
|-keep public class scala.collection.immutable.Seq
|-keep public class scala.collection.immutable.Set
|-keep public class scala.collection.immutable.Vector
""".stripMargin
}
Am Dienstag, 9. September 2014 08:10:38 UTC+2 schrieb David Pérez:
>
> Thanks a lot!
>
> BTW, SBT+your plugin is much faster than Gradle.
> Congratulations.
>
> Am Montag, 8. September 2014 18:14:01 UTC+2 schrieb pfn:
>>
>> transitiveAndroidLibs in Android := false
>>
>> in your app project configuration
>>
>> https://github.com/pfn/android-sdk-plugin#advanced-usage
>>
>> On Mon, Sep 8, 2014 at 5:57 AM, David Pérez <[email protected]>
>> wrote:
>>
>>> Hi,
>>>
>>> Has this problem <https://github.com/pfn/android-sdk-plugin/issues/99>
>>> happend to anybody else?
>>>
>>> trace] Stack trace suppressed: run last IncidenciasS/android:rGenerator for
>>> the full output.
>>> [error] (IncidenciasS/android:rGenerator) Error: more than one library with
>>> package name 'android.support.v7.appcompat'
>>> [error] You can temporarily disable this error with
>>> android.enforceUniquePackageName=false
>>> [error] However, this is temporary and will be enforced in 1.0
>>>
>>>
>>> I don't know the cause.
>>>
>>> Thanks for any help.
>>>
>>> David
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "scala-on-android" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
--
You received this message because you are subscribed to the Google Groups
"scala-on-android" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.