0
我想在我的項目中使用layoutopt(來自SDK)佈局。Android - layoutopt失敗
每次我運行在具有在它的Android版本:layout_weight'佈局的layoutopt地方,我得到這個異常:
Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 1
at java.lang.String.substring(Unknown Source)
at org.codehaus.groovy.runtime.DefaultGroovyMethods.getAt(DefaultGroovyMethods.java:2794)
at org.codehaus.groovy.runtime.dgm$213.doMethodInvoke(Unknown Source)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1058)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:886)
at org.codehaus.groovy.runtime.callsite.PojoMetaClassSite.call(PojoMetaClassSite.java:44)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:40)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:117)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
at Script5.run(Script5.groovy:15)
at com.android.layoutopt.uix.rules.GroovyRule$1.call(GroovyRule.java:50)
at org.codehaus.groovy.runtime.GroovyCategorySupport$ThreadCategoryInfo.use(GroovyCategorySupport.java:105)
at org.codehaus.groovy.runtime.GroovyCategorySupport.use(GroovyCategorySupport.java:212)
at com.android.layoutopt.uix.rules.GroovyRule.run(GroovyRule.java:65)
at com.android.layoutopt.uix.LayoutAnalyzer.applyRules(LayoutAnalyzer.java:246)
at com.android.layoutopt.uix.LayoutAnalyzer.analyze(LayoutAnalyzer.java:233)
at com.android.layoutopt.uix.LayoutAnalyzer.analyze(LayoutAnalyzer.java:238)
at com.android.layoutopt.uix.LayoutAnalyzer.analyze(LayoutAnalyzer.java:221)
at com.android.layoutopt.uix.LayoutAnalyzer.analyze(LayoutAnalyzer.java:153)
at com.android.layoutopt.uix.LayoutAnalyzer.analyze(LayoutAnalyzer.java:128)
at com.android.layoutopt.cli.Main.analyze(Main.java:61)
at com.android.layoutopt.cli.Main.analyzeFiles(Main.java:53)
at com.android.layoutopt.cli.Main.main(Main.java:46)
任何一個有想法,爲什麼發生這種情況?
您是否將屬性android:weightSum添加到父級佈局? –
告訴我們你的代碼 – blessenm
謝謝你的意見。我發現問題,計劃問題。我現在將展示這個例子,我可以發佈(低聲譽) – Yaniv