[TIMOB-27645] Android: Recurring builds broken (8.3.0 regression)
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Cannot Reproduce |
Resolution Date | 2020-03-03T17:46:16.000+0000 |
Affected Version/s | Release 8.3.0 |
Fix Version/s | n/a |
Components | Android |
Labels | engTriage |
Reporter | Hans Knöchel |
Assignee | Abir Mukherjee |
Created | 2019-12-07T12:42:01.000+0000 |
Updated | 2020-03-03T20:03:08.000+0000 |
Description
We noticed that since 8.3.0, incremental builds fail:
[ERROR] TiExceptionHandler: (main) [28,1550] Unable to start activity ComponentInfo{io.lambus.app/org.appcelerator.titanium.TiActivity}: android.content.res.Resources$NotFoundException: Resource ID #0x7f0e0000
[ERROR] TiExceptionHandler:
[ERROR] TiExceptionHandler: android.content.res.ResourcesImpl.getValue(ResourcesImpl.java:237)
[ERROR] TiExceptionHandler: android.content.res.Resources.getBoolean(Resources.java:1089)
[ERROR] TiExceptionHandler: android.support.v7.view.ActionBarPolicy.hasEmbeddedTabs(ActionBarPolicy.java:89)
[ERROR] TiExceptionHandler: android.support.v7.app.WindowDecorActionBar.init(WindowDecorActionBar.java:220)
[ERROR] TiExceptionHandler: android.support.v7.app.WindowDecorActionBar.<init>(WindowDecorActionBar.java:172)
[ERROR] TiExceptionHandler: android.support.v7.app.AppCompatDelegateImplV9.initWindowDecorActionBar(AppCompatDelegateImplV9.java:182)
[ERROR] TiExceptionHandler: android.support.v7.app.AppCompatDelegateImplBase.getSupportActionBar(AppCompatDelegateImplBase.java:145)
[ERROR] TiExceptionHandler: android.support.v7.app.AppCompatActivity.getSupportActionBar(AppCompatActivity.java:109)
[ERROR] TiExceptionHandler: org.appcelerator.titanium.view.TiActivitySafeAreaMonitor.getActionBarInsetHeight(TiActivitySafeAreaMonitor.java:287)
[ERROR] TiExceptionHandler: org.appcelerator.titanium.view.TiActivitySafeAreaMonitor.updateUsingCachedInsets(TiActivitySafeAreaMonitor.java:446)
[ERROR] TiExceptionHandler: org.appcelerator.titanium.view.TiActivitySafeAreaMonitor.updateUsing(TiActivitySafeAreaMonitor.java:423)
[ERROR] TiExceptionHandler: org.appcelerator.titanium.view.TiActivitySafeAreaMonitor.update(TiActivitySafeAreaMonitor.java:389)
[ERROR] TiExceptionHandler: org.appcelerator.titanium.view.TiActivitySafeAreaMonitor.start(TiActivitySafeAreaMonitor.java:339)
[ERROR] TiExceptionHandler: org.appcelerator.titanium.TiBaseActivity.onCreate(TiBaseActivity.java:723)
[ERROR] TiExceptionHandler: org.appcelerator.titanium.TiActivity.onCreate(TiActivity.java:47)
[ERROR] TiExceptionHandler: android.app.Activity.performCreate(Activity.java:7802)
[ERROR] TiExceptionHandler: android.app.Activity.performCreate(Activity.java:7791)
[ERROR] TiExceptionHandler: android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1299)
[ERROR] TiExceptionHandler: android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3245)
[ERROR] TiExceptionHandler: android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3409)
[ERROR] TiExceptionHandler: android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)
[ERROR] TiExceptionHandler: android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
[ERROR] TiExceptionHandler: android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
[ERROR] TiExceptionHandler: android.app.ActivityThread$H.handleMessage(ActivityThread.java:2016)
[ERROR] TiExceptionHandler: android.os.Handler.dispatchMessage(Handler.java:107)
[ERROR] TiExceptionHandler: android.os.Looper.loop(Looper.java:214)
[ERROR] TiExceptionHandler: android.app.ActivityThread.main(ActivityThread.java:7356)
[ERROR] TiExceptionHandler: java.lang.reflect.Method.invoke(Native Method)
[ERROR] TiExceptionHandler: com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
[ERROR] TiExceptionHandler: com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
The resource id 0x7f0e0000
maps to ic_launcher
inside the R.txt, so it seems like something is not copied over properly.
Changing a line of source code in the project fixes the issue again. Reproducible with our app that's available to the team.
Something is causing the "R.java" file to be regenerated with re-shuffled resource IDs, but the build system is not recompiling with the updated "R.java" here... [_build.js:compileJavaClasses()](https://github.com/appcelerator/titanium_mobile/blob/e9ef3702af3f75327af9056ec0bb9a7bf209e130/android/cli/commands/_build.js#L4074) The solution is to check if the "R.java" file has changed. We should probably grab a hash of the file before replacing it and check if there is a difference afterwards. If so, then set
builder.forceRebuild
totrue
. *Note 1:* This won't be an issue with Titanium 9.0.0 and higher. Only with older Titanium versions. *Note 2:* This issue shouldn't happen for device builds (ie: deploy type "test") since it always recompiles Java for subsequent builds.[~hknoechel], do you still see this issue with SDK 9.0.0 RC? If, not we can close this ticket.
Unable to reproduce using SDK version
9.0.0.v20200220034622
Like I said above, this issue won't happen in Titanium 9.0.0 and above. I can only reproduce it in older Titanium versions. It happens in Hans' app, but not in our test apps or in other customer apps (that I've seen).
Due to other SDK 9 issues we will not update too soon, but IIRC, it worked fine.