Code Monkey home page Code Monkey logo

Comments (6)

eighthave avatar eighthave commented on June 3, 2024 1

Right, I see what you mean, Build is used in translating the string value to the right integer. I just found the table that's used, the crazy thing is that it is read from the System Properties:

from androguard.

erev0s avatar erev0s commented on June 3, 2024 1

After giving some thought over it and seeing this issue, i think the next steps make sense:

  • Offer a method to do the mapping of a string to an API level
  • If the mapping fails, consider having some default value being returned
  • Warn the user that this is a valid case only for pre-release and the "check" is happening only against the platform running on (so its a specific edge case I would say)

given the inconsistency of other tools against this and the fact that this is an edge case, I would say it is of low priority but regardless its a "nice to have".

from androguard.

eighthave avatar eighthave commented on June 3, 2024

Hmm, makes me think about #1026 too. Seems like on both cases, androguard should do what the Android OS does when parsing these. That might mean just ignoring targetSdkVersion or maybe returning a default value?

from androguard.

erev0s avatar erev0s commented on June 3, 2024

Hi @eighthave, Android internally makes the conversion as defined here.
It would be nice to have it and it seems easy to be implemented.
Will add a flag to it, so I can get back to it in the future or if someone else wants to pick it up.

from androguard.

eighthave avatar eighthave commented on June 3, 2024

I don't think Build.java is where this parsing behavior is defined, or at least I can't see anything related there. Looks like here is the parsing:

And the crazy thing is that it looks like the parser there supports using a string there! APK formats are always full of surprises. The documentation says this field is "an integer":
https://developer.android.com/guide/topics/manifest/uses-sdk-element#target

from androguard.

erev0s avatar erev0s commented on June 3, 2024

Hi @eighthave, I was not clear enough thus the confusion.
I meant that the string/int values are described in the build.java file. As you correctly pointed out the computeTargetSdkVersion method helps with this "translation" and if you notice closely you will see how the build.java is being used (Although PackageParser is deprecated the exact same things apply for ParsingPackageUtils.java).

Indeed you are right, the developer documentation from Android states it as an integer, presumably because eventually it is converted to one. I can agree that the documentation can be improved.

from androguard.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.