Reputation: 11
When i set the true value but error what's am wrong with this code
Original
".field private isPro:Z"
My set
'''.field private isPro:Z=true'''
Upvotes: 0
Views: 927
Reputation: 97
you should use iput-boolean
in constructor or any method instead of assign directly when defining field.
.field private isPro:Z
#assign value
const/4 v0, 0
iput-boolean v0, p0, Lcom/example/YourClassPath;->isPro:Z
btw, direct assign only works in static
field like below
# not 0 not 1
.field private static isPro:Z = true
Upvotes: 1
Reputation: 992
In smali/dalvik "Z" means "boolean", in your case it is defining only the type, not the value:
.field private isPro:Z
Changing "Z" to "true" will not work, since "true" it is not a valid type. If you want to change its value, you need to search where the variable isPro is used, and change/override from 0x0 (false) to 0x1 (true).
Upvotes: 1