You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Android Studio同步Gradle遇“Error For input string: " 12"”错误求助

Fix: Gradle Sync Error - "Error For input string: " 12"" & ProjectConfigurationException

Let's break down this issue: that error message tells us Gradle is trying to parse a version string with a leading space (" 12") into a number, which fails. Looking at your build configs, here's how to fix this step by step:

1. Upgrade Google Services Plugin Version

Your root build.gradle uses com.google.gms:google-services:3.3.1—this version is too old to work with the Firebase 16.0.0 dependencies you're using. Firebase 16+ requires at least version 4.0.0 of the Google Services plugin.

Update the dependency in your root build.gradle:

buildscript {
    repositories {
        jcenter()
        google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.2'
        // Upgrade to a version compatible with Firebase 16
        classpath 'com.google.gms:google-services:4.2.0'
        classpath 'com.google.firebase:firebase-plugins:1.1.5'
    }
}

2. Pin SQLiteAssetHelper to a Specific Version

Using com.readystatesoftware.sqliteasset:sqliteassethelper:+ lets Gradle pull the latest version automatically, which might have introduced a version string with unexpected formatting (like that leading space). Swap the + for a stable, specific version:

// Replace the dynamic version with a fixed one (e.g., 2.0.1, the latest stable as of now)
implementation 'com.readystatesoftware.sqliteasset:sqliteassethelper:2.0.1'

3. Align OneSignal Plugin & SDK Versions

Your OneSignal Gradle plugin is on version 0.8.1, paired with an SDK version range [3.8.3, 3.99.99]. Older plugin versions can have bugs parsing version ranges, leading to weird string parsing issues. Upgrade the plugin to a compatible version:

// Update the plugin dependency in your module's build.gradle
buildscript {
    repositories {
        maven { url 'https://plugins.gradle.org/m2/' }
    }
    dependencies {
        classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:0.12.10'
    }
}

For extra stability, you can also pin the OneSignal SDK to a specific version instead of using a range:

implementation 'com.onesignal:OneSignal:3.15.3'

4. Clean Gradle Cache & Resync

After making these changes, clear out old cached data to avoid any lingering issues:

  • Go to File > Invalidate Caches... in Android Studio, select Invalidate and Restart
  • Alternatively, run this in your terminal:
./gradlew clean build --refresh-dependencies

These changes should resolve the version string parsing error and fix the ProjectConfigurationException you're seeing.

内容的提问来源于stack exchange,提问作者user4813855

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.29 07:02:00