React-Native编译报错:Failed to execute aapt,无改动突发问题求助
Hey there, sorry to hear you're stuck with this unexpected error—total bummer when you haven't touched your project in a week and it suddenly breaks out of nowhere! Let's go through some targeted checks and fixes based on your environment setup:
Your Environment Details
- Glade: 2.14.1
- React-Native: 0.49.3
compileSdkVersion: 25targetSdkVersion: 22
Possible Fixes to Try
1. Clear All Caches (Most Common Quick Fix)
Old React Native versions are prone to cache corruption that can cause random build failures. Run these commands one by one to wipe all cached data and reinstall dependencies:
watchman watch-del-all rm -rf node_modules rm -rf package-lock.json npm install rm -rf ios/build rm -rf android/build npm start -- --reset-cache
2. Check for Unintended Tool Updates
Even if you didn't modify your project, background updates to tools like Android SDK Build Tools, Node.js, or Glade might have broken compatibility:
- Verify your Android SDK Build Tools version matches
compileSdkVersion 25—stick to25.0.3(the most stable build tool version for SDK 25). - Double-check that your Node.js version is compatible with React Native 0.49.3 (v8.x is recommended; newer versions can cause issues with this old RN release).
3. Test on a Compatible Android Version
React Native 0.49.3 doesn't play well with newer Android versions (API 26+). If your test device/emulator updated to a newer OS recently, try running the app on an Android 7.1.1 (API 25) emulator instead—this often resolves sudden compatibility crashes.
4. Validate Gradle Configuration
Old RN versions require specific Gradle plugin versions. Open your android/build.gradle file and ensure the classpath for Gradle is set to a compatible version:
dependencies { classpath 'com.android.tools.build:gradle:2.2.3' // ... other dependencies }
Avoid using Gradle plugin versions newer than 2.3.x with RN 0.49.3—they'll cause build conflicts.
From the error screenshot you shared, it likely points to a build configuration mismatch or cached resource issue, so starting with the cache clear is your best bet.
内容的提问来源于stack exchange,提问作者Abraham Rosa Vargas

