Hi Atsushi
On 2011.09.26 09:21, Atsushi Eno wrote:
Hello,
Are your ApiDemos files on your machine somehow under some
symbolik link directory?
No. Plain Windows (Vista, separate partition for projects).
I had been having that issue in my development machine and I
have a fix for me, but it does not always reproduce nor others don't
experience that, and hence left buggy...
We can fix it too, and get around, but thought (cos those are the
samples) it would
not harm to report and see what is going on in there.
(My fix works only for Posix platforms so it's not for you anyways.)
If it's not the case for you, then I have no idea why it happens.
I believe it is not the case for us, but this is what I suspect:
1. API demo (newly pulled from git)
1. error:
D:\SRC\MonoDroid\monodroid-samples\ApiDemo\Resources\drawable\android_button.xml(4):
error 1:
No resource found that matches the given name (at 'drawable'
with value '@drawable/AndroidPressed').
[D:\SRC\MonoDroid\monodroid-samples\ApiDemo\ApiDemo.csproj]
2. android_button.xml
<?xml version="1.0" encoding="utf-8"?>
<selector
xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/AndroidPressed"
android:state_pressed="true" />
<item android:drawable="@drawable/android_focused"
android:state_focused="true" />
<item android:drawable="@drawable/android_normal" />
</selector>
3. Compile is fine, but it crashes on packaging!
4. renaming AndroidPressed.png to androidpressed.png leads to
expected packaging error
D:\SRC\MonoDroid\monodroid-samples\ApiDemo\Resources\drawable\android_button.xml(4):
error 1:
No resource found that matches the given name (at 'drawable'
with value '@drawable/AndroidPressed').
[D:\SRC\MonoDroid\monodroid-samples\ApiDemo\ApiDemo.csproj]
5. changing "@drawable/AndroidPressed" to
"@drawable/androidpressed" in android_button.xml
Does the job!
2. our "UserControl" sample (layout reuse) with
1. "Form" Main.axml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<Button
android:id="@+id/MyButton"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/Hello"
/>
<RelativeLayout android:id="@+id/RelativeLayout03"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true">
<include layout="@layout/UserControlAdvertizer" />
</RelativeLayout>
</LinearLayout>
2. "UserControl" UserControlAdvertizer.axml
<merge xmlns:android="http://schemas.android.com/apk/res/android">
<LinearLayout
android:id="@+id/UserControlAdvertizer"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
xmlns:android="http://schemas.android.com/apk/res/android"
>
<TextView
android:id="@+id/textViewAdvertisement"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Add"
/>
</LinearLayout>
</merge>
3. sample crashes on packaging again:
C:\Program
Files\MSBuild\Novell\Novell.MonoDroid.Common.targets(399,2):
error MSB6006:
"mandroid.exe" exited with code 1.
[csproj]
C:\Program Files\MSBuild\Novell\mandroid.exe -v --nosign
--sdk-dir="C:\Program Files\Android\android-sdk-windows"
--builddir="D:\SRC\HolisticWare\HolisticWare.MonoAds\Project\obj\Debug\android"
--framework-dir="C:\Program Files\Reference
Assemblies\Microsoft\Framework\MonoAndroid\v2.2"
--framework-dir="C:\Program Files\Reference
Assemblies\Microsoft\Framework\MonoAndroid\v1.0"
-S="D:\SRC\HolisticWare\HolisticWare.MonoAds\Project\obj\Debug\res"
--package="Project" --nolink --abi="armeabi"
--java-sdk-dir="C:\Program Files\Java\jdk1.6.0_26" --debug
--manifest-template="D:\SRC\HolisticWare\HolisticWare.MonoAds\Project\Properties\AndroidManifest.xml"
--sdk-platform="8"
"D:\SRC\HolisticWare\HolisticWare.MonoAds\Project\bin\Debug\Project.dll"
"D:\SRC\HolisticWare\HolisticWare.MonoAds\HolisticWare.MonoAds\bin\Debug\HolisticWare.MonoAds.DLL_023_BL_mClnt_MDrd_mono26.dll"
"C:\Program Files\Reference
Assemblies\Microsoft\Framework\MonoAndroid\v2.2\Mono.Android.dll"
"C:\Program
Files\Reference
Assemblies\Microsoft\Framework\MonoAndroid\v1.0\mscorlib.dll"
"C:\Program Files\Reference
Assemblies\Microsoft\Framework\MonoAndroid\v1.0\System.Core.dll"
"C:\Program Files\Reference
Assemblies\Microsoft\Framework\MonoAndroid\v1.0\System.dll"
"C:\Program Files\Reference
Assemblies\Microsoft\Framework\MonoAndroid\v1.0\System.ServiceModel.dll"
"C:\Program Files\Reference
Assemblies\Microsoft\Framework\MonoAndroid\v1.0\System.Web.Services.dll"
"C:\Program Files\Reference
Assemblies\Microsoft\Framework\MonoAndroid\v1.0\System.Xml.dll"
"C:\Program Files\Reference
Assemblies\Microsoft\Framework\MonoAndroid\v1.0\System.Xml.Linq.dll"
MonoDroid.Utils.CommandFailedException: Operation is not
valid due to the current state of the object
at
MonoDroid.Utils.ProcessRocks+<ReadStandardOutput>c__Iterator6.MoveNext
() [0x00000] in <filename unknown>:0
at Monodroid.Toolbox.InvokeCommand (IEnumerable`1
commandLine) [0x00000] in <filename unknown>:0
at Monodroid.Toolbox.InvokeAapt (System.String packageName)
[0x00000] in <filename unknown>:0
at Monodroid.Droidinator.CreatePackagedResources
(System.Collections.Generic.List`1 javaTypes) [0x00000] in
<filename unknown>:0
at Monodroid.Droidinator.CreateApk () [0x00000] in
<filename unknown>:0
at Monodroid.MainClass.Main (System.String[] argv)
[0x00000] in <filename unknown>:0
4. so in obj\Debug\res\layout
1. there is no UserControlAdvertizer.axml, but
usercontroladvertizer.axml
2. in main.axml there is
<include layout="@layout/UserControlAdvertizer" />
which is not there!
5. so changing
<include layout="@layout/UserControlAdvertizer" />
to
<include layout="@layout/usercontroladvertizer" />
solves the problem.
AFAIK packaging renames the resource files (changes them to lowercase),
but does not change the
content and referencing resources from resource file fails during packaging!
The solution could be to modify content of resource files too if
filename is chaged.
We have few suggestions here, but in a separate mail.
thanks and greetings
mel
Atsushi Eno
Hi
We have worked this weekend too...
Tried to explain layout reuse (like UserControls) and got following
exception:
MonoDroid.Utils.CommandFailedException:
Operation is not valid due to the current state of the object
by mandroid.exe
Googled and led us to original post (by us/me) about resources and
filename casing in
monodroid samples.
1. Selector for pngs
There is selector in xml file to select png to display. Probably
java code is generated
based on this xml.
<?xml version="1.0" encoding="utf-8"?>
<selector
xmlns:android="http://schemas.android.com/apk/res/android"
<http://schemas.android.com/apk/res/android>>
<item android:drawable="@drawable/androidpressed"
android:state_pressed="true" />
<item android:drawable="@drawable/android_focused"
android:state_focused="true" />
<item android:drawable="@drawable/android_normal" />
</selector>
To solve exception AndroidPressed was changed to androidpressed
2. xml layout (wrapped in <merge> tag) for reuse.
Idea was for hardcore .netters to explain "Simulation" of
UserControls
main layout <let say Form>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
<http://schemas.android.com/apk/res/android>
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<Button
android:id="@+id/MyButton"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/Hello"
/>
<RelativeLayout android:id="@+id/RelativeLayout03"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true">
<include layout="@layout/usercontroladvertizer" />
</RelativeLayout>
</LinearLayout>
And UserControlAdvertizer looked like
<merge
xmlns:android="http://schemas.android.com/apk/res/android"
<http://schemas.android.com/apk/res/android>>
<LinearLayout
android:id="@+id/UserControlAdvertizer"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
xmlns:android="http://schemas.android.com/apk/res/android"
<http://schemas.android.com/apk/res/android>
>
<TextView
android:id="@+id/textViewAdvertisement"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Add"
/>
</LinearLayout>
</merge>
We colud not get rid off exception until filenames in parent
control/layout
for child layouts/controls were not lowercase
It seems that this exception can be avoided if in parent/master
layout ids that are mapped
to filenames should be lowercase, cos this is probably where
java/native-stuff steps in and
it is mostly done in lowercase...
greetings
mel
On 2011.09.21 10:53, Miljenko Cvjetko wrote:
HI
I know this Asset naming problem is known, just it would be nice to
correct
samples on github for those which are not familiar with this issue
and for those
to come.
For a purpose of one presentationfor several students, just pulled
src from github
yesterday and got error.
Problem:
1. Select device started, message "Packaging Application"
2. new window "Packaging failed"
Could not create the Android package. See the Output (Build)
window for more details.
3. Output/Build:
C:\Program Files\MSBuild\Novell\mandroid.exe -v --nosign
--sdk-dir="C:\Program Files\Android\android-sdk-windows"
--builddir="D:\SRC\MonoDroid\monodroid-samples\ApiDemo\obj\Debug\android"
--framework-dir="C:\Program Files\Reference
Assemblies\Microsoft\Framework\MonoAndroid\v2.2"
--framework-dir="C:\Program Files\Reference
Assemblies\Microsoft\Framework\MonoAndroid\v1.0"
-S="D:\SRC\MonoDroid\monodroid-samples\ApiDemo\obj\Debug\res"
--package="mono.samples.apidemo" --nolink --abi="armeabi"
--java-sdk-dir="C:\Program Files\Java\jdk1.6.0_26" --debug
--manifest-template="D:\SRC\MonoDroid\monodroid-samples\ApiDemo\Properties\AndroidManifest.xml"
--sdk-platform="8"
-A="D:\SRC\MonoDroid\monodroid-samples\ApiDemo\obj\Debug\assets"
"D:\SRC\MonoDroid\monodroid-samples\ApiDemo\bin\Debug\MonoDroid.ApiDemo.dll"
"C:\Program Files\Reference
Assemblies\Microsoft\Framework\MonoAndroid\v2.2\Mono.Android.dll"
"C:\Program Files\Reference
Assemblies\Microsoft\Framework\MonoAndroid\v1.0\mscorlib.dll"
"C:\Program Files\Reference
Assemblies\Microsoft\Framework\MonoAndroid\v1.0\System.Core.dll"
"C:\Program
Files\Reference
Assemblies\Microsoft\Framework\MonoAndroid\v1.0\System.dll"
"C:\Program Files\Reference
Assemblies\Microsoft\Framework\MonoAndroid\v1.0\System.Xml.dll"
"C:\Program Files\Reference
Assemblies\Microsoft\Framework\MonoAndroid\v1.0\System.Xml.Linq.dll"
MonoDroid.Utils.CommandFailedException: Operation is not valid
due to the current state of the object
at
MonoDroid.Utils.ProcessRocks+<ReadStandardOutput>c__Iterator6.MoveNext
() [0x00000] in <filename unknown>:0
at Monodroid.Toolbox.InvokeCommand (IEnumerable`1 commandLine)
[0x00000] in <filename unknown>:0
at Monodroid.Toolbox.InvokeAapt (System.String packageName)
[0x00000] in <filename unknown>:0
at Monodroid.Droidinator.CreatePackagedResources
(System.Collections.Generic.List`1 javaTypes) [0x00000] in
<filename unknown>:0
at Monodroid.Droidinator.CreateApk () [0x00000] in <filename
unknown>:0
at Monodroid.MainClass.Main (System.String[] argv) [0x00000] in
<filename unknown>:0
D:\SRC\MonoDroid\monodroid-samples\ApiDemo\Resources\drawable\android_button.xml(4):
error 1: No resource found that matches the given name (at
'drawable' with value '@drawable/AndroidPressed').
[D:\SRC\MonoDroid\monodroid-samples\ApiDemo\ApiDemo.csproj]
Done Building Project
"D:\SRC\MonoDroid\monodroid-samples\ApiDemo\ApiDemo.csproj"
(SignAndroidPackage target(s)) -- FAILED.
Build FAILED.
Solution:
1. in
D:\SRC\MonoDroid\monodroid-samples\ApiDemo\Resources\drawable\android_button.xml
changed:
<?xml version="1.0" encoding="utf-8"?>
<selector
xmlns:android="http://schemas.android.com/apk/res/android"
<http://schemas.android.com/apk/res/android>>
<item android:drawable="@drawable/AndroidPressed"
android:state_pressed="true" />
<item android:drawable="@drawable/android_focused"
android:state_focused="true" />
<item android:drawable="@drawable/android_normal" />
</selector>
to:
<?xml version="1.0" encoding="utf-8"?>
<selector
xmlns:android="http://schemas.android.com/apk/res/android"
<http://schemas.android.com/apk/res/android>>
<item android:drawable="@drawable/androidpressed"
android:state_pressed="true" />
<item android:drawable="@drawable/android_focused"
android:state_focused="true" />
<item android:drawable="@drawable/android_normal" />
</selector>
2. renamed/moved:
D:\SRC\MonoDroid\monodroid-samples\ApiDemo\Resources\drawable\AndroidPressed.png
to
D:\SRC\MonoDroid\monodroid-samples\ApiDemo\Resources\drawable\androidpressed.png
regards
mel
--
--
Miljenko Cvjetko dipl.ing. ET
Direktor/CEO
Projektant rješenja/Solution Architect
Razvojni programer/Senior developer
Voditelj projekta/Project Manager
IX južna obala 13
Kajzerica Zagreb
T: 385 1 7775555
M: 385 91 557 447 3
F: 385 1 7779556
e:[email protected] <mailto:[email protected]>
w:http://www.holisticware.net
_______________________________________________
Monodroid mailing list
[email protected]
UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid
--
Miljenko Cvjetko dipl.ing. ET
Direktor/CEO
Projektant rješenja/Solution Architect
Razvojni programer/Senior developer
Voditelj projekta/Project Manager
IX južna obala 13
Kajzerica Zagreb
T: 385 1 7775555
M: 385 91 557 447 3
F: 385 1 7779556
e: [email protected]
w: http://www.holisticware.net
_______________________________________________
Monodroid mailing list
[email protected]
UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid