Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't access PercentRelativeLayout

Tags:

android

xml

ant

I want to use PercentRelativeLayout in a command line project using Ant under win10. I'm new to Android but have a Java background (as a programmer). I'm also new to Ant.

Thanks for your help. chatt

I've updated the SDK Manager to Android 6.0 (API 23) with Android Tools 24.4.1 and installed v23.2 of the Android Support Lib.

I have the following:

C:\Users\chatt\AppData\Local\Android\sdk1\extras\android\support\percent

and

C:\Users\chatt\AppData\Local\Android\sdk1\extras\android\support\v14\preference\libs

The critical error is: No resource identifier found for attribute 'layout_marginTopPercent' in package 'com.Chatterton.Peter.ChessClock'

This is my first post here so if I could have improved upon it pls let me know.

Thanks again.

main.xml

<?xml version="1.0" encoding="utf-8"?>
<android.support.percent.PercentRelativeLayout
         xmlns:android="http://schemas.android.com/apk/res/android"
         xmlns:app="http://schemas.android.com/apk/res-auto"
         android:layout_width="match_parent"
         android:layout_height="match_parent">
<ImageView
          app:layout_marginTopPercent="25%"
          app:layout_marginLeftPercent="25%"
          app:layout_widthPercent="50%"
          app:layout_heightPercent="50%" />
</android.support.percent.PercentRelativeLayout>

Compile Results:

D:\Android\ChessClock>ant debug
Buildfile: D:\Android\ChessClock\build.xml
-set-mode-check:
-set-debug-files:
-check-env:
 [checkenv] Android SDK Tools Revision 24.4.1
 [checkenv] Installed at C:\Users\chatt\AppData\Local\Android\sdk1
-setup:
     [echo] Project Name: ChessClock
  [gettype] Project Type: Application
-set-debug-mode:
-debug-obfuscation-check:
-pre-build:
-build-setup:
[getbuildtools] Using latest Build Tools: 21.1.2
     [echo] Resolving Build Target for ChessClock...
[gettarget] Project Target:   Google APIs
[gettarget] Vendor:           Google Inc.
[gettarget] Platform Version: 5.0.1
[gettarget] API level:        21
[gettarget] WARNING: No minSdkVersion value set. Application will install on all Android versions.
     [echo] ----------
     [echo] Creating output directories if needed...
    [mkdir] Created dir: D:\Android\ChessClock\bin\rsObj
    [mkdir] Created dir: D:\Android\ChessClock\bin\rsLibs
     [echo] ----------
     [echo] Resolving Dependencies for ChessClock...
[dependency] Library dependencies:
[dependency] No Libraries
[dependency]
[dependency] ------------------
     [echo] ----------
     [echo] Building Libraries with 'debug'...
   [subant] No sub-builds to iterate on
-code-gen:
[mergemanifest] Found Deleted Target File
[mergemanifest] Merging AndroidManifest files into one.
[mergemanifest] Manifest merger disabled. Using project manifest only.
     [echo] Handling aidl files...
     [aidl] No AIDL files to compile.
     [echo] ----------
     [echo] Handling RenderScript files...
     [echo] ----------
     [echo] Handling Resources...
     [aapt] Generating resource IDs...
     [aapt] D:\Android\ChessClock\res\layout\main.xml:8: error: No resource identifier found for attribute 'layout_marginTopPercent' in package 'com.Chatterton.Peter.ChessClock'
like image 637
chatt Avatar asked Feb 22 '26 21:02

chatt


1 Answers

Not sure if you can get it working with ant.

You could try switching to Gradle, and then you need to add the following dependency to the app build.gradle file:

"compile 'com.android.support:percent:23.1.2'"

like image 154
blacharnia Avatar answered Feb 24 '26 09:02

blacharnia



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!