1

i m build signed apk and i have android studio 2.1.2

my build.gradle file as below

apply plugin: 'com.android.application'

android {
compileSdkVersion 22
buildToolsVersion "22.0.1"

defaultConfig {
    applicationId "com.my.pkg"
    minSdkVersion 15
    targetSdkVersion 22
    versionCode 1
    versionName "1.0"
    multiDexEnabled true

}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
dexOptions {
    preDexLibraries = false
    javaMaxHeapSize "4g"
  }
}

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile files('libs/apache-mime4j-0.6.jar')
compile files('libs/gson-2.1.jar')
compile files('libs/httpmime-4.0.1.jar')
compile files('libs/json_simple-1.1.jar')
compile 'com.android.support:cardview-v7:22.+'
compile 'com.github.ksoichiro:android-observablescrollview:1.5.0'
compile 'com.android.support:appcompat-v7:22+'
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.android.support:design:22.+'
compile 'de.hdodenhof:circleimageview:2.0.0'
compile 'com.android.support:recyclerview-v7:22.+'
compile 'com.google.android.gms:play-services:7.+'
compile 'com.android.support:multidex:1.0.0'


  compile project(':cropper')

}

When i build apk i get following error ExternalSystemException: String index out of range: -97

  String index out of range: -97
  com.intellij.openapi.externalSystem.model.ExternalSystemException: String index out of range: -97
at      org.jetbrains.plugins.gradle.service.project.GradleExecutionHelper.execute(GradleExecutionHelper.java:238)
at    com.android.tools.idea.gradle.invoker.GradleTasksExecutor.invokeGradleTasks(GradleTasksExecutor.java:416)
at com.android.tools.idea.gradle.invoker.GradleTasksExecutor.run(GradleTasksExecutor.java:222)
at com.intellij.openapi.progress.impl.CoreProgressManager$TaskRunnable.run(CoreProgressManager.java:563)
at com.intellij.openapi.progress.impl.CoreProgressManager$2.run(CoreProgressManager.java:142)
at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:446)
at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:392)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:54)
at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:127)
at com.intellij.openapi.progress.impl.ProgressManagerImpl$1.run(ProgressManagerImpl.java:126)
at com.intellij.openapi.application.impl.ApplicationImpl$8.run(ApplicationImpl.java:366)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
at org.jetbrains.ide.PooledThreadExecutor$1$1.run(PooledThreadExecutor.java:55)

any idea how can i solve this ? you all suggestions are appreciable

Harshal Kalavadiya
  • 2,412
  • 4
  • 38
  • 71
  • Kalvadiya did u tried cleaning the code and then building? – Jagjit Singh Jun 07 '16 at 07:15
  • Jagjit Singh- Yes i clean project but still getting same error – Harshal Kalavadiya Jun 07 '16 at 10:08
  • I'll go ahead and mention that all `compile files('libs/` lines are unnecessary... `compile fileTree... ` already compiles your JAR files. Doesn't fix the problem, but just a pointer – OneCricketeer Jul 28 '16 at 03:44
  • 1
    Possible duplicate of [Android: ExternalSystemException: String index out of range: -130 building release](http://stackoverflow.com/questions/32575778/android-externalsystemexception-string-index-out-of-range-130-building-relea) – Abdulla Nilam Aug 03 '16 at 20:09

2 Answers2

2

This is usually caused by missing translation strings

to see the error run

./gradlew assemble

from your project root. you will see something like this

String out of bound exception gradle

If your string is not translatable like fb app id, then just set translatable attribute to false

enter image description here

In other case, make sure you have translations in all languages you specified

vanna
  • 949
  • 2
  • 9
  • 16
0

I think this question is answered here basically look at gradle console it will show you where the problem.

Community
  • 1
  • 1
Bwire
  • 1,181
  • 1
  • 14
  • 25