进行应用内购买时获取零点异常

时间:2019-03-25 02:18:06

标签: android android-fragments gradle

在对android.test.purchased进行测试时,购买运行良好,但是在滚动播放商店时,购买完成后便会崩溃。

以下是完成购买的代码。

这是崩溃堆栈:

java.lang.NullPointerException:

def creation_role():
    print("""What is your character's role?\n
A: Lord (Base stats: Charisma  7, Wit 3, Valor 5)
B: Peaseant (Base stats: Charisma  5, Wit 7, Valor 3)
C: Knight (Base stats: Charisma  3, Wit 5, Valor 7)""")
    role = input("> ")
    role = role.lower()

    if "a" in role:
        role = "lord"
        charisma = 7
        wit = 3
        valor = 5
    elif "b" in role:
        role = "peaseant"
        charisma = 5
        wit = 7
        valor = 3
    elif "c" in role:
        role = "knight"
        charisma = 3
        wit = 5
        valor = 3
    else:
        error()
        creation_role()



def creation_home():
    print("""Choose where you hail from:\n
A. Hillford: Lush foliage as far as the eyes can see, the enchanted trees
bear the fruit of wisdom.\n
B. Aermagh: A land as beautiful as it is cold, it's people learn strength
from the first day of life fighting frostbite as a babe.\n
C. Venzor: The rich island nation some call it the pearl of Skystead,
In recent decades it's seen outsiders giddy to make quick riches.""")
    home = input("> ")
    home = home.lower()

    if "a" in home:
        home = "Hillford"
        wit + 2
    elif "b" in home:
        home = "Aermagh"
        valor + 2
    elif "c" in home:
        home = "Venzor"
        charisma + 2
    else:
        error()
        creation_home()

def test():
    creation_role()
    creation_home()
    print(home, "\n", charisma, "\n", wit, "\n", valor)

test()

0 个答案:

没有答案