Just read this question (Android facebook applicationId cannot be null) and really hoped it would fix my issue too.
It is similar, however, I'm working with ANT and added the App ID's in the build.xml.
The build runs fine, the logs don't show anything weird. I see that the somehow adding the App ID in the Manifest tricks Android into thinking it's an Integer, while it should actually be a String. And whatever I try, I still get the same error and the app keeps crashing.
applicationId cannot be null
I tried escaping the application id's when specifying them, like so:
<property
name="fb_app_id_a"
value="\ XXXXXXXXXXXX" />
But it resulted in the same error. So I tried to be smart and added the escaping later, but to no avail:
<replaceregexp
file="AndroidManifest.xml"
flags="g"
match="android:value="#string/app_id""
replace="android:value="\ ${fb_app_id_a}"" />
I try to replace the conventional implementation with the build.xml, because we have to use several app ID's. Although the logs of the build I ran look fine, still it's giving me hell to get the build automation done because of this issue. Am I doing something wrong, or should I be doing it differently?
Does anybody have experience with build automation and the use of multiple app ID's for Facebook?
Thanks a bunch!
What I use to change some value in the manifests file is:
<replaceregexp file="AndroidManifest.xml" match='android:label=".*"'
replace='android:label="my new value"'/>
With this, I will change android:label="some value" to android:label="my new value"
I guess that in your case will be:
<property name="fb_app_id_a" value="some value" />
<replaceregexp file="AndroidManifest.xml" match='property name="fb_app_id_a" value=".*"'
replace='property name="fb_app_id_a" value="your new value"'/>
Also, to decomple the apk and see the AndroidManifest.xml helped me a lot
Related
It seems that the TeamCity parameter ${build.counter} is not resolving in our ant build.xml. We have:
<replaceregexp
file="AndroidManifest.xml"
match='android:versionCode="(.*)"'
replace='android:versionCode="${build.counter}"'
/>
This throws the error:
String types not allowed (at 'versionCode' with value '${build.counter}')
It looks like it is taking the parameter "${build.counter}" as a literal string.
Using another TeamCity integer parameter in place of ${build.counter}, for example ${teamcity.build.id}, works fine.
Does anyone know why this might be?
Update
Thanks Biswajit_86 for the answer. Here also is my related discussion with JetBrains:
Your build files wont know the value of build.counter at all. They can only read system properties but build.counter is a config parameter.
To do this declare a system parameter named system.BUILD.COUNTER whoose value is %build.counter% and pass this into your target. If you change your abnt build.xml to read ${BUILD.COUNTER}, it will work fine
build parameters section
system.BUILD.COUNTER %build.counter%
build xml file
<replaceregexp
file="AndroidManifest.xml"
match='android:versionCode="(.*)"'
replace='android:versionCode="${BUILD.COUNTER}"'
/>
Ant won't read teamctiy varaibles directly. You'll need to create a similar build.counter property in your ant project like:
<property name="build.conuter" value=""/>
and pass its value from Teamcity build step like:
We have a unique situation where we are deploying a Xamarin.Android app to China to 33 app stores. Hence, our solution has 33 application projects, and we setup Jenkins (running on Windows) to package and sign all our apks (otherwise it would be crazy to make builds).
We also need to modify android:versionCode and android:versionName in the manifest file, by using the ${SVN_REVISION} value from Jenkins. Is there a way to pass these values command line to MSBuild?
Normally we would hand edit this value, but it's not possible because of so many application projects.
Our build parameters right now look like this in Jenkins:
/p:Configuration=Release;AndroidKeyStore=True;AndroidSigningKeyStore=ourkeystore.keystore;AndroidSigningStorePass=ourpassword;AndroidSigningKeyAlias=ouralias;AndroidSigningKeyPass=ourpassword /t:SignAndroidPackage
Add this to the end of your *.csproj file, before the ending </Project> tag:
<Target Name="BeforeBuild" Condition=" '$(JENKINS)' == '1' ">
<XmlPoke XmlInputPath="Properties\AndroidManifest.xml" Namespaces="<Namespace Prefix='android' Uri='http://schemas.android.com/apk/res/android' />" Query="manifest/#android:versionCode" Value="$(SVN_REVISION)" />
<XmlPoke XmlInputPath="Properties\AndroidManifest.xml" Namespaces="<Namespace Prefix='android' Uri='http://schemas.android.com/apk/res/android' />" Query="manifest/#android:versionName" Value="2.0.$(SVN_REVISION)" />
</Target>
I have Jenkins configured to pass JENKINS=1 and SVN_REVISION. When it goes to build, it modifies AndroidManifest.xml before the build.
I don't know if this will work on xbuild on a Mac or not, depends on if XmlPoke is implemented. I should do a blog post on this.
No. You'll have to manipulate the android:versionCode and android:versionName yourself. Personally, I use a rake task to handle this particular detail.
I want to auto-increment the versionCode and versionName of the manifest file of the android app when I click on Export (to export a new version of the app)
I found the second answer here (Auto increment version code in Android app) extremely useful (comment include .exe programs to auto increment Android versionCode) , however, they made it run on Build, I want it to run when I click on File -> Export , see image please
You might consider modifying the File -> Export button to execute a builder to increment the version code (as shown in the post you mentioned) in addition to that button's usual functionality. The org.eclipse.ui.menus extension point seems like a good starting point. (Disclaimer: I haven't tried this.)
However, it might be good to keep the following xkcd in mind here:
I have done this with a ton of custom ant steps.
First, you need to extract the build number into a properties file. Let's call it version.properties
Then, the step to increment the version code is:
<target name="increment-version-code">
<propertyfile file="version.properties">
<entry key="versionCode" type="int" default="0" operation="+" value="1" />
</propertyfile>
</target>
This will read the entry versionCode, increment it and save it back to version.properties.
So far, so good. The last step is to get that versionCode into the AndroidManifest.xml file and unfortunately now it gets messy.
The way I solved it was to regenerate the manifest from a template on every build using the filtering functionality in ant.
<target name="generate-manifest">
<filter filtersfile="version.properties"/>
<copy todir="${source.dir}" overwrite="true" verbose="true" filtering="true">
<fileset dir="${source.dir}" casesensitive="false">
<include name="**/*.base"/>
</fileset>
<mapper type="glob" from="*.base" to="*" />
</copy>
</target>
Then, all you have left to do is move your AndroidManifest.xml to AndroidManifest.xml.base and replace your versionCode attribute to read android:versionCode="#versionCode#" . You can then run the increment-version-code target to bump the versionCode in version.properties and the generate-manifest target to convert the .base template into the final manifest.
These can then be easily added as build steps to your Eclipse project or as dependencies to exported ant builds. Unfortunately, there's no easy hook for the Export functionality (though, there is for "After Clean", which I find good enough).
Of course, with Gradle on the horizon, all of this would have to be rewritten soon. :(
Trying to make an app using phonegap 1.4.1 + phonegap's childbrowser plugin.
I've been following guides and digging a lot on the subject, but I'm stuck on an error I can't understand.
I've moved the childbrowser.java to the correct location and added this to the plugins.xml:
<plugin name="ChildBrowser" value="com.phonegap.plugins.childBrowser.ChildBrowser"/>
added this to the androidmanifest.xml:
<activity android:name="com.phonegap.DroidGap" android:label="#string/app_name">
<intent-filter>
</intent-filter>
</activity>
But I get an error on the ChildBrowser.java on this line:
package com.phonegap.plugins.childBrowser;
telling me that the declared package com.phonegap.plugins.childBrowser does not match the expected package com.phonegap.plugins.ChildBrowser.
I changed it to capital C in childbrowser.java, and the error went away, but ofc, the plugin didn't work.
i found this topic, discussing it, but no appearant fix
http://comments.gmane.org/gmane.comp.handhelds.phonegap/11993
I have tried renaming the plugin name in plugins.xml
Earlier, i was trying to whitelist some url's, but kept getting them blocked, so i'm thinking there's something wrong with my /res/xml directory? its meant to be projectroot/res/xml, right?
Any help will be greatly appreciated.
If you've created the package "com.phonegap.plugins.ChildBrowser" in your Eclipse project then you need to modify the plugins.xml line to be:
<plugin name="ChildBrowser" value="com.phonegap.plugins.ChildBrowser.ChildBrowser"/>
to match the actual package of the plugin.
Make sure the ChildBrowser java file is in the package you declared in plugins.xml, which is in root/res/xml/ folder.
You need to add the javascript file to your main page, so the page can call it's methods. Check that the javascript file contents are consistent with you java file location - for example the packages may be different.
Add the right permissions
Make sure you call the plugin from javascript the right way, for example in phonegap 1.3 it goes like this:
window.plugins.childBrowser.onLocationChange = function(loc)
{
...
i'm trying to get android running on a gumstix overo system.
since i'm not planning to use the final "product" as a phone, i asked my self if it is possible to exclude applications like the phone/dialer-app from the kernel build-process (any config parameter probably?)
Just remove (or comment) these lines:
<project path="packages/apps/Phone" name="platform/packages/apps/Phone" />
<project path="packages/apps/VoiceDialer" name="platform/packages/apps/VoiceDialer" />
(and others if needed) from the platform manifest (default.xml) :
https://android.googlesource.com/platform/manifest/+/master/default.xml
Removing the app declarations in the repo manifest did not work for me, as there are other libraries that reference them that then fail to compile. The build system approach to this problem is to create/modify your product definition makefile to not include the specific apps.
So, for the overo you probably already have a products/overo.mk product file. You can manually set the PRODUCT_PACKAGES variable to which applications you want to ship. You will also want to take a look at the PRODUCT_POLICY variable, as it defines sets of applications for your product type.
It can take some fiddling to get everything to build correctly, due to interdependencies between applications, but the Android build output does a pretty good job of explaining the problems when they arise.