In my android project: inner element must either be a resource reference or empty - android-studio-3.0

Android Studio 3.2.1
In my build.gradle:
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.myproject"
minSdkVersion 19
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
In my res\values\ids.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<item type="id" name="tokenEntryLogo">false</item>
<item type="id" name="action0">false</item>
<item type="id" name="cancel_action">false</item>
<item type="id" name="status_bar_latest_event_content">false</item>
<item type="id" name="media_actions">false</item>
</resources>
but I get error:
> Task :app:generateDebugResValues UP-TO-DATE
> Task :app:generateDebugResources UP-TO-DATE
> Task :app:mergeDebugResources FAILED
> Task :app:buildInfoGeneratorDebug
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:mergeDebugResources'.
> java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource compilation failed
app\src\main\res\values\ids.xml:192:5-48: AAPT: error: <item> inner element must either be a resource reference or empty.
app\src\main\res\values\ids.xml:229:5-51: AAPT: error: <item> inner element must either be a resource reference or empty.
\app\src\main\res\values\ids.xml:46:5-51: AAPT: error: <item> inner element must either be a resource reference or empty.

Find your ids.xml file, and modify like this.
before:
<item name="back_btn" type="id">false</item>
after:
<item name="back_btn" type="id"/>
Tips
you can use any of editor like 'sublime'.
then,
Find: >false</item>
Replace: />
It's all done!

Related

Generating html report of junit xml generated of python unit tests

I have python unit test report generated by junit in xml fomrat from the jenkins.
<?xml version="1.0" encoding="utf-8"?>
<testsuites>
<testsuite name="pytest" errors="0" failures="0" skipped="1" tests="3" time="0.023" timestamp="2021-08-29T21:42:01.852698" hostname="infinity">
<testcase classname="tests.SimpleTest" name="test_fail" time="0.000" />
<testcase classname="tests.SimpleTest" name="test_pass" time="0.000" />
<testcase classname="tests.SimpleTest" name="test_skipped" time="0.000">
<skipped type="pytest.skip" message="demonstrating skipping">
/var/lib/jenkins/workspace/GithubExample/tests.py:10: demonstrating skipping
</skipped>
</testcase>
</testsuite>
</testsuites>
Now I want to generate an html report which then I can use Publish HTML report plugin to publish to be accessible from confluence.
Now at my workplace I do not have junit macro and maybe not have other html generation plugin what I have is xsltproc ,
I tried to generated htmlreport using xsltproc but it throws an error
xsltproc test-result.xml stylesheet.xslt > index.html
warning: failed to load external entity "test-result.xml"
cannot parse test-result.xml
You can use junit2html. It is easy to use and provides a few options to print tests summary to terminal output or create a summary in the html too.
Even though it is a python module, you can execute it from shell.
Example: junit2html report.xml report.html

Reading a ditamap in ant xslt task

I'm trying to read ditamap file from my XSLT stylesheet processing using fn:doc() function. But ant fails because DTD public identifier cannot be resolved even if there is catalog file specified.
[ditamap: mKeyDefUi.ditamap]
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE map PUBLIC "-//OASIS//DTD DITA Map//EN" "map.dtd">
<map>
<keydef keys="UI_Action">
<topicmeta>
<keywords>
<keyword>処理</keyword>
</keywords>
</topicmeta>
</keydef>
<keydef keys="UI_ActionAfterPrinting">
<topicmeta>
<keywords>
<keyword>印刷終了時の設定</keyword>
</keywords>
</topicmeta>
</keydef>
...
</map>
[ant buld.xml main part]
<property name="key.map.url" value="file:/D:/SVN/acme-dev/VisualWorks/ja-JP/keydef-map/mKeyDefUi.ditamap"/>
<property name="dita.catalog.file" value="/D:/DITA-OT/dita-ot-2.5.2/catalog-dita.xml"/>
...
<!-- Main target -->
<target name="uicontrol.conv">
<echo message="topic.file.prop=${topic.file.prop}"/>
<antcall target="uicontrol.conv.impl">
<param name="prmTopicFileProp" value="${topic.file.prop}"/>
<param name="prmOutputDirUrl" value="${output.dir.url}"/>
<param name="prmKeyMapUrl" value="${key.map.url}"/>
<param name="prmLogFileUrl" value="${log.file.url}"/>
</antcall>
</target>
<target name="uicontrol.conv.impl">
<property name="dummy.input" value="${basedir}/dummy-in.xml"/>
<property name="dummy.output" value="${basedir}/dummy-out.xml"/>
<property name="xsl.file" value="${basedir}/xsl/convUicontrol.xsl"/>
<xslt processor="trax" in="${dummy.input}" out="${dummy.output}" style="${xsl.file}" force="true">
<factory name="net.sf.saxon.TransformerFactoryImpl"/>
<param name="PRM_TOPIC_FILE_PROP" expression="${prmTopicFileProp}"/>
<param name="PRM_OUTPUT_DIR_URL" expression="${prmOutputDirUrl}"/>
<param name="PRM_KEY_MAP_URL" expression="${prmKeyMapUrl}"/>
<param name="PRM_LOG_FILE_URL" expression="${prmLogFileUrl}"/>
<xmlcatalog>
<catalogpath>
<pathelement location="${dita.catalog.file}"/>
</catalogpath>
</xmlcatalog>
</xslt>
</target>
[The ant log]
Executing:
"c:\program files\oxygen xml editor 19\jre/bin/java" -Xmx256m -classpath "C:\Program Files\Oxygen XML Editor 19\tools\ant/lib/ant-launcher.jar" "-Dant.home=C:\Program Files\Oxygen XML Editor 19\tools\ant" org.apache.tools.ant.launch.Launcher -lib "D:\My_Documents\Java\SaxonPE9-8-0-3J\saxon9pe.jar" -lib "D:\My_Documents\Java\xml-commons-resolver-1.2\resolver.jar" -lib "D:\My_Documents\Java\xml-commons-external-1.4.01\xml-apis.jar" -lib "D:\My_Documents\Java\xml-commons-external-1.4.01\xml-apis-ext.jar" -f "build.xml" "-Dwebhelp.trial.license=no" -v -d
Apache Ant(TM) version 1.9.8 compiled on December 25 2016
Buildfile: D:\SVN\acme\key\uicontrol-conv\build.xml
Adding reference: ant.PropertyHelper
Detected Java version: 1.8 in: c:\program files\oxygen xml editor 19\jre
Detected OS: Windows 8.1
...
uicontrol.conv.impl:
Setting project property: dummy.input -> D:\SVN\acme\key\uicontrol-conv/dummy-in.xml
Setting project property: dummy.output -> D:\SVN\acme\key\uicontrol-conv/dummy-out.xml
Setting project property: xsl.file -> D:\SVN\acme\key\uicontrol-conv/xsl/convUicontrol.xsl
[xslt] Using class org.apache.tools.ant.taskdefs.optional.TraXLiaison
[xslt] In file D:\SVN\acme\key\uicontrol-conv\dummy-in.xml time: 1504138459522
[xslt] Out file D:\SVN\acme\key\uicontrol-conv\dummy-out.xml time: 0
[xslt] Style file D:\SVN\acme\key\uicontrol-conv/xsl/convUicontrol.xsl time: 1504138455268
[xslt] Processing D:\SVN\acme\key\uicontrol-conv\dummy-in.xml to D:\SVN\acme\key\uicontrol-conv\dummy-out.xml
[xslt] Loading stylesheet D:\SVN\acme\key\uicontrol-conv\xsl\convUicontrol.xsl
java.lang.NoSuchFieldException: _isNotSecureProcessing
resolve: 'util_string.xsl' with base: 'file:/D:/SVN/acme/key/uicontrol-conv/xsl/convUicontrol.xsl'
Class org.apache.tools.ant.types.resolver.ApacheCatalogResolver loaded from parent loader (parentFirst)
Apache resolver library found, xml-commons resolver will be used
Using catalogpath 'D:\DITA-OT\dita-ot-2.5.2\catalog-dita.xml'
Parsing D:\DITA-OT\dita-ot-2.5.2\catalog-dita.xml
resolve: 'file:/D:/SVN/acme-dev/VisualWorks/ja-JP/keydef-map/mKeyDefUi.ditamap' with base: 'file:/D:/SVN/acme/key/uicontrol-conv/xsl/convUicontrol.xsl'
resolveEntity: '-//OASIS//DTD DITA Map//EN': 'file:/D:/SVN/acme-dev/VisualWorks/ja-JP/keydef-map/map.dtd'
No matching catalog entry found, parser will use: 'file:/D:/SVN/acme-dev/VisualWorks/ja-JP/keydef-map/map.dtd'
[xslt] D:\SVN\acme\key\uicontrol-conv\xsl\convUicontrol.xsl:17:4: Fatal Error! I/O error reported by XML parser processing file:/D:/SVN/acme-dev/VisualWorks/ja-JP/keydef-map/mKeyDefUi.ditamap: D:\SVN\acme-dev\VisualWorks\ja-JP\keydef-map\map.dtd (Specified file does not found.) Cause: java.io.FileNotFoundException: D:\SVN\acme-dev\VisualWorks\ja-JP\keydef-map\map.dtd (Specified file does not found.)
[xslt] Failed to process D:\SVN\acme\key\uicontrol-conv\dummy-in.xml
[antcall] Exiting D:\SVN\acme\key\uicontrol-conv\build.xml.
BUILD FAILED
D:\SVN\acme\key\uicontrol-conv\build.xml:20: The following error occurred while executing this line:
D:\SVN\acme\key\uicontrol-conv\build.xml:32: Fatal error during transformation using D:\SVN\acme\key\uicontrol-conv\xsl\convUicontrol.xsl: I/O error reported by XML parser processing file:/D:/SVN/acme-dev/VisualWorks/ja-JP/keydef-map/mKeyDefUi.ditamap: D:\SVN\acme-dev\VisualWorks\ja-JP\keydef-map\map.dtd (Specified file does not found.); SystemID: file:/D:/SVN/acme/key/uicontrol-conv/xsl/convUicontrol.xsl; Line#: 17; Column#: 4
The xslt task loaded the newest DITA-OT catalog file. But public identifier '-//OASIS//DTD DITA Map//EN' was not resolved.
What is wrong with my build.xml?
You should also try to add a classpath reference to the Xerces library "xercesImpl.jar".
Also this error line in your console output:
java.lang.NoSuchFieldException: _isNotSecureProcessing
would seem to indicate that there is an attempt to use the Xalan TransformerFactoryImpl.

Framework not found (RoboVM Google adMob)

I am trying to add google admob to my Libgdx project that uses RoboVM. I followed the guide here: https://github.com/robovm/robovm-robopods/tree/master/google-mobile-ads/ios but I am getting this error:
ERROR] ld: framework not found GoogleMobileAds
[ERROR] clang: error: linker command failed with exit code 1 (use -v to
see invocation)
[ERROR] Couldn't compile app
However I followed the instructions to put the following code in the robovm.xml file:
<config>
<executableName>${app.executable}</executableName>
<mainClass>${app.mainclass}</mainClass>
<os>ios</os>
<arch>thumbv7</arch>
<target>ios</target>
<iosInfoPList>Info.plist.xml</iosInfoPList>
<resources>
<resource>
<directory>../android/assets</directory>
<includes>
<include>**</include>
</includes>
<skipPngCrush>true</skipPngCrush>
</resource>
<resource>
<directory>data</directory>
</resource>
</resources>
<forceLinkClasses>
<pattern>com.badlogic.gdx.scenes.scene2d.ui.*</pattern>
<pattern>com.badlogic.gdx.graphics.g3d.particles.**</pattern>
<pattern>com.android.okhttp.HttpHandler</pattern>
<pattern>com.android.okhttp.HttpsHandler</pattern>
<pattern>com.android.org.conscrypt.**</pattern>
<pattern>com.android.org.bouncycastle.jce.provider.BouncyCastleProvider</pattern>
<pattern>com.android.org.bouncycastle.jcajce.provider.keystore.BC$Mappings</pattern>
<pattern>com.android.org.bouncycastle.jcajce.provider.keystore.bc.BcKeyStoreSpi</pattern>
<pattern>com.android.org.bouncycastle.jcajce.provider.keystore.bc.BcKeyStoreSpi$Std</pattern>
<pattern>com.android.org.bouncycastle.jce.provider.PKIXCertPathValidatorSpi</pattern>
<pattern>com.android.org.bouncycastle.crypto.digests.AndroidDigestFactoryOpenSSL</pattern>
<pattern>org.apache.harmony.security.provider.cert.DRLCertFactory</pattern>
<pattern>org.apache.harmony.security.provider.crypto.CryptoProvider</pattern>
</forceLinkClasses>
<libs>
<lib>z</lib>
</libs>
<frameworkPaths>
<path>libs</path>
</frameworkPaths>
<frameworks>
<framework>UIKit</framework>
<framework>OpenGLES</framework>
<framework>QuartzCore</framework>
<framework>CoreGraphics</framework>
<framework>OpenAL</framework>
<framework>AudioToolbox</framework>
<framework>AVFoundation</framework>
<framework>GoogleMobileAds</framework>
</frameworks>
</config>
EDIT:
Here's the build.gradle for iOS module:
sourceSets.main.java.srcDirs = [ "src/" ]
sourceCompatibility = '1.7'
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
ext {
mainClassName = "com.samuel.doubledodge.IOSLauncher"
}
launchIPhoneSimulator.dependsOn build
launchIPadSimulator.dependsOn build
launchIOSDevice.dependsOn build
createIPA.dependsOn build
robovm {
archs = "thumbv7:arm64"
}
eclipse.project {
name = appName + "-ios"
natures 'org.robovm.eclipse.RoboVMNature'
}
To anyone who was having this issue, TomGrillGames' solution in the comments above was what solved my problem.I was putting it in the ios/builds/libs instead of ios/libs.

Ant rpm build fails due to unknown option '-bs'

build.xml
<?xml version="1.0"?>
<project default="main" basedir=".">
<echo message="pulling in property files" />
<property file="axis_bujava.properties" />
<echo message="calling the RPM Build Ant" />
<target name="main">
<rpm specfile="example.spec" topdir="${basedir}" command="-bs" />
</target>
</project>
example.spec
Summary: xxx
Name: cdplayer
Version: 1.0
Release: 1
Copyright: xxx
Group: Applications/Sound
Source: xxx.tgz
URL: http://xxx.html
Distribution: xxxx
Vendor:xxx.
Packager: xxx
%description
xxxx
%build
make
%install
make install
output:
Buildfile: /home/user1/workspace/antdemo/build.xml
[echo] pulling in property files
[echo] calling the RPM Build Ant
main:
[rpm] Building the RPM based on the example.spec file
[rpm] -bs: unknown option
[rpm] 'rpm' failed with exit code 1
BUILD SUCCESSFUL
Total time: 848 milliseconds
I had this issue too. In my case the OS did not have the 'rpmbuild' command installed, so the ant task was calling 'rpm' instead as Aaron suggested.
While I'm not sure what "-bs" option is, you might try changing it to "-bb", which is the default. My own builds, plus a few I've seen, usually use -bb (http://richardfriedman.blogspot.com/2007/02/rpm-java-and-frustration.html)
Also see:
http://ant.apache.org/manual/Tasks/rpm.html

CustomizableOutDir=true breaks MSTest.exe during Team Build

When using CustomizableOutDir, I'm having problems with TFS Team Build firing off MSTest.exe properly.
TFSBuild.rsp
/verbosity:diagnostic
/p:CustomizableOutDir=true
TFSBuild.proj (solutions to build snippet)
<!-- code -->
<SolutionToBuild Include="$(BuildProjectFolderPath)/../../foo.csproj">
<Properties>OutputPath=$(BinariesRoot)\WindowsServices\foo\</Properties>
</SolutionToBuild>
<!-- tests -->
<SolutionToBuild Include="$(BuildProjectFolderPath)/../../test/test.sln">
<Targets>t1;t2</Targets>
<Properties>OutputPath=$(BinariesRoot)\TestHarness\</Properties>
</SolutionToBuild>
With both <Properties>OutputPath=$(BinariesRoot)\TestHarness\</Properties> and <Properties></Properties>, I get the following error at the end of the build:
"C:\build\BuildType\TFSBuild.proj"
(TestConfiguration target) (1:12) ->
(CoreTestConfiguration target) ->
MSBUILD : warning MSB6003: The
specified task executable "MSTest.exe"
could not be run. The directory name
is invalid
After finding this article, I and then added the following:
<Target Name="AfterCompile">
<ItemGroup>
<SolutionOutputs Condition="'%(CompilationOutputs.Solution)' == '$(Solution)'" Include="%(RootDir)%(Directory)**\*.*" />
<ServiceOutputs Include="$(BinariesRoot)\WindowsServices\**\*.*" />
<TestHarnessOutputs Include="$(BinariesRoot)\TestHarness\*.*" />
</ItemGroup>
<Copy SourceFiles="#(SolutionOutputs)" DestinationFolder="$(TeamBuildOutDir)" />
<Copy SourceFiles="#(ServiceOutputs)" DestinationFolder="$(TeamBuildOutDir)" />
<Copy SourceFiles="#(TestHarnessOutputs)" DestinationFolder="$(TeamBuildOutDir)" />
</Target>
Which gave this:
(AfterCompile target) ->
C:\build\BuildType\TFSBuild.proj(289,5):
error MSB3023: No destination
specified for Copy. Please supply
either "DestinationFiles" or
"DestinationDirectory".
DestinationDirectory is not part of the schema http://schemas.microsoft.com/developer/msbuild/2003, but I figured I would try it anyway. So I changed all the DestinationFolder on the copy tasks to DestinationDirectory and as expected I got this:
(AfterCompile target) ->
C:\build\BuildType\TFSBuild.proj(288,44):
error MSB4064: The
"DestinationDirectory" parameter is
not supported by the "Copy" task.
Verify the parameter exists on the
task, and it is a settable public
instance property.
C:\build\BuildType\TFSBuild.proj(288,5):
error MSB4063: The "Copy" task could
not be initialized with its input
parameters.
Anybody out there have CustomizableOutDir and MSTest working together in harmony with their TFS Team Build?
EDIT:
I found this discussion and applied this change:
<Target Name="BeforeTest">
<!-- The tests won't run if the binaries directory does not exist -->
<MakeDir
Directories="$(BinariesRoot)\%(ConfigurationToBuild.FlavorToBuild)"
Condition="!Exists('$(BinariesRoot)\%(ConfigurationToBuild.FlavorToBuild)')" />
</Target>
Which resulted in this:
"C:\build\BuildType\TFSBuild.proj"
(RunTest target) (1:11) ->
"C:\build\BuildType\TFSBuild.proj"
(TestConfiguration target) (1:12) ->
(CoreTestConfiguration target) ->
MSBUILD : warning MSB6006:
"MSTest.exe" exited with code 1.
This made tfs/mstest/msbuild happy.
<Target Name="BeforeTest">
<!-- The tests won't run if the binaries directory does not exist -->
<MakeDir
Directories="$(BinariesRoot)\%(ConfigurationToBuild.FlavorToBuild)"
Condition="!Exists('$(BinariesRoot)\%(ConfigurationToBuild.FlavorToBuild)')" />
</Target>
Not getting any test results was a different problem with the deployment and test box configuration.

Resources